Given an m × n matrix where each row is sorted and the first element of each row is greater than the last element of the previous row, determine if a target value exists.
Key insight: treat the 2D matrix as a single sorted array. If there are m rows and n columns, index i maps to matrix[i // n][i % n].
Then run standard binary search on indices 0 to m*n - 1. Time: O(log(m*n)).
search_matrix(matrix, 3)
True
search_matrix(matrix, 13)
False