| 13 | class Solution { |
| 14 | public: |
| 15 | bool searchMatrix(vector<vector<int>>& matrix, int target) { |
| 16 | int x = matrix.size(); |
| 17 | if (x < 1) return false; |
| 18 | int y = matrix[0].size(); |
| 19 | if (y < 1) return false; |
| 20 | int i = x - 1, j = 0; |
| 21 | while (i >= 0 and j < y) { |
| 22 | if (matrix[i][j] == target) return true; |
| 23 | else if (matrix[i][j] < target) j ++ ; |
| 24 | else if (matrix[i][j] > target) i -- ; |
| 25 | } |
| 26 | return false; |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | int main() { |
nothing calls this directly
no outgoing calls
no test coverage detected