My Blog List

[Leetcode Solution] Search a 2D Matrix

Analysis 

  • Use binary search two times. First search the right row and second search the right column
    • Search for the biggest element that smaller then target
    • Search the exact element equals to target

Note

Code


UPDATED AT LEETCODE 2ND PASS

No comments:

Post a Comment

Enter you comment