Loading...
Loading...
Loading...
A map has land cells (1) and water cells (0). A patch is a group of land cells joined by shared sides. Print the number of cells in the largest patch, or 0 if there is no land.
Example 1
Input
4 5 11000 11010 00100 00011
Output
4
Example 2
Input
2 3 000 000
Output
0
Try the problem first. Open one hint at a time.
Count the cells while you search each patch.
Keep the biggest count.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor