id |
title |
topics |
difficulty |
source |
2 |
Matrix Islands |
array |
depth-first-search |
matrix |
|
easy |
|
Question
'''
Given a matrix of 0s and 1s, count the number of islands present.
[[0,0,1],
[0,0,0],
[0,1,1]]
Answer: 2
'''
Follow Up
Given a matrix of 0s and 1s, find the size of the largest island present.
'''
[[0,0,1],
[0,0,0],
[0,1,1]]
Answer: 2
Follow Up II
Given a matrix of 0s and 1s, find the number of unique islands present present.
'''
[[1,0,1,0],
[1,0,0,0],
[0,1,1,0]]
Answer: 3
[[1,1,0,1],
[0,0,0,0],
[0,1,1,0]]
Answer: 2