Reddit
Experience
·
Apr 2026
Distinct Island by Destroying Islands.
3 upvotes
6 replies
Interview Experience
Is it viable to tackle a DI problem by essentially “turning the islands to water”? Like each time you encounter a “new” island, DFS all the connecting island, each time setting the island value to a w
Full Details
Is it viable to tackle a DI problem by essentially “turning the islands to water”? Like each time you encounter a “new” island, DFS all the connecting island, each time setting the island value to a water? Basically instead of doing a seen set, you’d know each time you saw an island, you know for sure you wouldn’t have seen it before because all islands before then had been “destroyed”.
Free preview. Unlock all questions →
Topics
Graphs