Searching in sorted 2D Array ​
Searching in sorted 2D Array — LeetCode
Search for a target in an m x n matrix where each row is sorted and the first element of each row is greater than the last of the previous row.
Approach ​
Binary search -> Think of the array as a 1D array. left = 0, right = length -1. Calculate mid. The element will be at [mid/rowLength][mid % rowLength]