Medium
Quiz
#74 Search a 2D Matrix
APPROACH
An m x n integer matrix has two properties: each row is non-decreasingly sorted, and the first element of each row is greater than the last element of the row above. Return true if target is in the matrix. The solution must run in O(log(m * n)) time.
Example 1:
Input: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3
Output: true
Example 2:
Input: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13
Output: false
1 of 4
1:00
What is the optimal approach for this problem?