Search a 2D Matrix
1 | Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: |
1 | Input: |
Solution 1
We can get the number of the row that the target may be in, and then search in that row.
1 | class Solution { |
Solution 2-Binary Search
1 | class Solution { |