You are given a 2 D array of potentially unequal height and width containing only 0s and 1s . In that matrix each 1 represents land and each 0 represents water. An island is defined as any number of 1s that are horizontally and vertically adjacent(but not diagonally adjacent) and that don't touch the borders of the matrix. You can think of islands as a patch of 1s. you are allowed to mutate the input matrix. Write a function that returns a modified version of the matrix where all the islands are removed
e.g.
1 0 0 0 1
0 1 0 0 0
1 1 1 0 0
Output:
1 0 0 0 1
0 0 0 0 0
1 1 1 0 0
Comments (0)

