t

class Solution {
public:

bool searchHOne(const vector<vector<int>>& matrix,int h,int s,int e,int target)
{
    if(s > e) return false;
    
    if(matrix[h][s] == target) return true;
    
    int mid = (s + e) >> 1;
    if(matrix[h][mid] > target)
        return searchHOne(matrix,h,mid + 1,e);
    else
        return searchHOne(matrix,h,s,mid - 1);
}

bool searchVOne(const vector<vector<int>>& matrix,int v,int s,int e,int target)
{
    
}

bool searchSquareMatrix(const vector<vector<int>>& matrix,int h0,int v0,int num,int target)
{
    num = num - 1;
    
    if(matrix[h0 + num][v0 + num] == target) return true;
    
    if(matrix[h0 + num][v0 + num] < target) return false;
    
    int i = 0;
    while(i < num && matrix[h0 + i][v0 + i] < target)
        i++;
    
    if(matrix[h0 + i][v0 + i] == target) return true;
    
    if(i == 0) return false;        
    
    return (searchHOne(matrix,h0 + i,h0,h0 + i,target) || searchVOne(matrix,v0 + i,v0,v0 + i,target)  );
}

bool searchMatrix(const vector<vector<int>>& matrix, int h0,int hnum,int v0,int vnum, int target)
{
    
}

bool searchMatrix(vector<vector<int>>& matrix, int target) {
    
    int m = matrix.size(),n = matrix[0].size();
    
}

};

posted on 2021-06-04 18:26  Ultraman_X  阅读(36)  评论(0编辑  收藏  举报

导航