240. Search a 2D Matrix II
# Medium
find the fisrt position in a row bigger than target, then throw corresponded columns
consider edge case

matrix is
mrows andncolumns,m * n
Solution 1:
check from first to last row, find the first position in a row bigger than target, then throw one row or a few columns with one row
do search insertion position in each row
time complexity:
Soultion 2:
check from right top or left bottom element, every time throw one column or row
Time complexity:
Last updated
Was this helpful?