思路
定位于左下角 矩阵有序且左下角没有岔路
当目标数大于当前数时 向右移动
当目标数小于当前数时 向上移动
class Solution {
public:bool Find(int target, vector<vector<int> > array) {
int col,row,i,j;
col=array[0].size();
row=array.size();
i=row-1;
j=0;
while(i>=0&&j<=col-1)
{
if(target<array[i][j])
{
i--;
}
else if(target>array[i][j])
{
j++;
}
else
{
return true;
}
}
return false;
}
};