Search a Sorted Matrix
Every row of matrix is sorted left to right, and the first number of each row is bigger than the last number of the row above it. Return True if target appears anywhere in the grid, otherwise False.
Hint: you can treat the whole grid as one long sorted list.
Example 1
matrix [[1,3,5,7],[10,11,16,20],[23,30,34,60]]
target 16
returns true
16 is in the second row.
Example 2
matrix [[1,3,5,7],[10,11,16,20],[23,30,34,60]]
target 13
returns false
13 is nowhere.
Constraints
1 <= rows, cols <= 6- Rows and columns follow the sorted order described above.
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.