Marks :10
: 2 | : 0
You are given an n x m binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.
The area of an island is the number of cells with a value 1 in the island.
Return the maximum area of an island in grid. If there is no island, return 0.
The first line contains N (1 <= N <= 1e4) and M (1 <= M <=1e4)
The next N lines contains M integers, 0 or 1 representing the grid.
N*M <= 1e4 for all test cases
Output a single integer, max are of the island.
5 5 0 0 0 1 0 0 0 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0
8
5 5 0 0 1 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1
3
3 3 0 0 0 0 0 0 0 0 0
0
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.