$1 \leq n, m \leq 300$
-- $-10^9 \leq \text{matrix[i][j]} \leq 10^9$
-- All the integers in each row are sorted in ascending order.
-- All the integers in each column are sorted in ascending order.
-- $-10^9 \leq target \leq 10^9$
-
----
-
-## Solution for Search a 2D Matrix II
-
-### Intuition and Approach
-
-To search for a value in this matrix efficiently, we can utilize the properties of the matrix. Since the matrix is sorted both row-wise and column-wise, we can start our search from the top-right corner of the matrix. From here, we have two options:
-1. If the target is greater than the current value, move downwards.
-2. If the target is less than the current value, move leftwards.
-
-This approach ensures that we eliminate one row or one column in each step, leading to an efficient search.
-
-- Input: matrix = [ - [1, 4, 7, 11, 15], - [2, 5, 8, 12, 19], - [3, 6, 9, 16, 22], - [10, 13, 14, 17, 24], - [18, 21, 23, 26, 30] - ], target = 5 -
-- Output: {result ? "true" : "false"} -
-