A grid-traversal classic that tests BFS/DFS flood fill and the visited-marking discipline. The signal is treating the grid as a graph and counting connected components. Here is the answer.
Unlock the other 750 answers · ₹2,000 / $25Your progress and mastery stay saved · 6 months · one payment · no auto-renew
