Junior — Senior
Search for a given number in a sorted two-dimensional matrix
livecode
Task condition
It is required to implement an efficient algorithm that searches for a number t in an integer matrix of size m × n. The matrix has two properties:
- Each row's elements are sorted in ascending order from left to right.
- The first element of any row is greater than the last element of the previous row.
Example: Input: mat = [[1, 3, 5, 7], [10, 11, 16, 20], [23, 30, 34, 60]], t = 3 Output: true