Apply Staircase Search


#1

use staircase search to solve easily in O(m+n)