Given an M * N matrix in which each row and each column is sorted in ascending order, write a method to find an element.
how to solve
The above link is very easy understanding.
We begin with the upper right corner. Instead of traversing diagonally each step, we traverse one step to the left or bottom. Essentially, each step we are able to eliminate either a row or a column. This algorithm runs in O(n+m).