Practice Minimum Number of Days to Disconnect Island
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Minimum Number of Days to Disconnect Island
Problem Statement
You are given an m x n binary grid grid where 1 represents land and 0 represents water. An island is a maximal 4-directionally (horizontal or vertical) connected group of 1's. The grid is said to be connected if we have exactly one island, otherwise is said disconnected. In one day, we are allowed to change any single land cell (1) into a water cell (0). Return the minimum number of days to disconnect the grid.
Source: Minimum Number of Days to Disconnect Island on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
grid = [[0,1,1,0],[0,1,1,0],[0,0,0,0]]
2
# Example 2
grid = [[1,1]]
2
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Number of Days to Disconnect Island.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.