[testcase too weak] Abviously wrong solution passes the judge


  • 0
        bool searchMatrix(vector<vector<int>>& matrix, int target) {
            for(int i=0, j = matrix[0].size();i<matrix.size();++i) {
                auto it = lower_bound(matrix[i].begin(), matrix[i].begin()+j,target);
                if(it == matrix[i].begin()+j) continue;
                if(*it == target)return true;
                j = it - matrix[i].begin();
            }
            return false;
        }
    

    this solution fails against this test case:
    [[1,1000,1000,1000],[2,3,4,5],[3,10,11,12]]
    11

    But it passes OJ.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.