Can we just apply the solution for Number of Islands Here?

  • 0

    It seems the OJ accepts my code for number of islands, and there's no big difference in terms of time complexity.

  • 0

    The difference will be in your memory consumption, as the Number of Islands requires O(N) of memory.

Log in to reply

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