class Solution {
public:
  //从左到右是递增从上到下递增,右上角作为比较点利用排除法
    bool Find(int target, vector<vector<int> >& array) {
        int row = 0;
        int col = array[0].size()-1;

        while(row < array.size() && col >= 0){
            if( array[row][col] == target){
                return true;
            }else if(array[row][col] < target){
                row++;
            }else if(array[row][col] > target){
                col--;
            }
        }
        return false;
    }
};