class Solution { public: bool Find(int target, vector<vector<int> >& array) { int row=0; int col =array[0].size()-1; bool flag=false; while(row>=0&&row<array.size()&&col>=0&&col<array[0].size()) { if(target==array[row][col]) flag=true; if(target>array[row][col]) { //排除最上面一列 row++; } else { //排除最右一列 col--; } } return flag; } };