//解题思路:因为二维数组在行和列是递增的,那么我们从右上角查起,如果是就找到,如果目标比此值大,转到下一行开始找,
如果比此值小,那么就在此行找,知道找到边界没找到就返回false;
class Solution {
public:
bool Find(int target, vector<vector<int> > array) {
int row = array.size()-1;
int col = array[0].size()-1;
int i=0,j=col;
while(i<=row&&j>=0)
{
if(array[i][j]==target)
return true;
if(array[i][j]>target)
j--;
else
i++;
}
return false;
}
};