704.二分查找
https://leetcode.cn/problems/binary-search/description/
59.螺旋矩阵II
https://leetcode.cn/problems/spiral-matrix-ii/description/、
参考题解写出
54.螺旋矩阵
https://leetcode.cn/problems/spiral-matrix/description/
class Solution { public:vector<int> spiralOrder(vector<vector<int>>& matrix) {int m = matrix.size();int n = matrix[0].size();int t = 0, l = 0, b = m - 1, r = n - 1;vector<int> ans;int num_size = m*n;while(num_size > 0){for(int i = l; i <= r && num_size > 0; i++){ans.push_back(matrix[t][i]);//从左到右num_size--;} t++;for(int i = t; i <= b && num_size > 0; i++){// 从上到下ans.push_back(matrix[i][r]);num_size--;}r--;for(int i = r; i >= l && num_size > 0; i--){//从右到左ans.push_back(matrix[b][i]);num_size--;}b--;for(int i = b; i >= t && num_size > 0; i--){//从下到上ans.push_back(matrix[i][l]);num_size--;}l++;}return ans;} };