filmov
tv
Minimum Number of Days to Disconnect Island - Leetcode 1568 - Java

Показать описание
Problem Description
Program to calculate the minimum number of days to disconnect the grid.
More details:
You are given an m x n binary 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.
Program to calculate the minimum number of days to disconnect the grid.
More details:
You are given an m x n binary 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.