Skip to content

Files

Latest commit

a84d085 · Feb 28, 2019

History

History
This branch is up to date with piyush01123/Daily-Coding-Problems:master.

084

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 28, 2019
Feb 28, 2019

This problem was asked by Amazon.

Given a matrix of 1s and 0s, return the number of "islands" in the matrix. A 1 represents land and 0 represents water, so an island is a group of 1s that are neighboring whose perimeter is surrounded by water.

For example, this matrix has 4 islands.

1 0 0 0 0
0 0 1 1 0
0 1 1 0 0
0 0 0 0 0
1 1 0 0 1
1 1 0 0 1