运行时间:13ms
占用内存:1496k
class Solution {
public:
bool Find(int target, vector<vector<int> > array) {
int rows = 0;
int cols = array[0].size() - 1;
while(rows < array.size() && cols >= 0)
{
if(array[rows][cols] == target)
{
return true;
}
else if(array[rows][cols] > target)
cols--;
else rows++;
}
return false;
}
};