Skip to content

Latest commit

 

History

History

leftmost-column-with-at-least-a-one

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

< Previous                  Next >

Related Topics

[Array] [Binary Search] [Matrix] [Interactive]

Hints

Hint 1 1. (Binary Search) For each row do a binary search to find the leftmost one on that row and update the answer.
Hint 2 2. (Optimal Approach) Imagine there is a pointer p(x, y) starting from top right corner. p can only move left or down. If the value at p is 0, move down. If the value at p is 1, move left. Try to figure out the correctness and time complexity of this algorithm.