If do DFS on this problem, isn't the time complexity O(n)?


  • 2

    I read many binary search solution, good, but time complexity is n*O(n)
    I feel like DSF on this problem is O(n), am I wrong,
    we only go thru '1' grids and once for each, so it is O(n) ?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.