Meta Interview Question

2D array with 0 and 1, find islands.

Interview Answer

Anonymous

Jul 28, 2018

Yep, use DFS and mark the 1's as visited inside the DFS and add 1 to the island's count when you find a 1 before doing the DFS.