Problem
You are given an m x n grid of integers matrix with two properties: each row is sorted in ascending order, and the first value of each row is greater than the last value of the row above. Return true if target is in the matrix and false otherwise, in O(log(m · n)) time.
Example 1
matrix = [[1, 3, 5, 7],
Example 2
[10, 11, 16, 20],
Example 3
[23, 30, 34, 60]]
Example 4
- Input
- target = 3
- Output
- true
Example 5
- Input
- target = 13
- Output
- false
Constraints
m == matrix.length, n == matrix[i].length1 <= m, n <= 100-10^4 <= matrix[i][j], target <= 10^4