Find a value in a sorted grid
A grid of distinct integers is sorted so that reading it row by row, left to right, gives one increasing sequence: each row increases, and each row's first value is greater than the last value of the row before. Given that grid grid (m rows of n values) and an integer target, return [row, col] where target sits, or [-1, -1] if it is not there.
grid may be empty ([]); otherwise every row has the same length, at least 1. Aim for O(log(m · n)): checking every cell is O(m · n).
Examples
find_in_grid([[2,5,9,11],[14,18,21,30],[33,40,47,52]], 21)→[1,2]find_in_grid([[2,5,9,11],[14,18,21,30],[33,40,47,52]], 13)→[-1,-1]find_in_grid([[2,5,9,11],[14,18,21,30],[33,40,47,52]], 2)→[0,0]