Microsoft Interview Question

Given a sorted integer matrix where columns and rows are increasing, efficiently find if an element exists in this matrix (n x m).

Interview Answer

Anonymous

Oct 10, 2018

should just be a binary search for row and then binary search for the index within the row. time complexity: O(log(n) + log(m))