Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Return 0 if the grid is already disconnected.
Return 1 if changing a single land to water disconnect the island.
Otherwise return 2.
We can disconnect the grid within at most 2 days.