Island Counter

Count the number of 1s islands in a matrix of 0s and 1s.

Medium1/5/2024

Problem statement

Given a matrix of 0s and 1s, count the number of 1s islands. An island is a group of 1s that are connected horizontally and vertically, but not diagonally.

Problem leaderboard

#
Size
%
Users
#1
104 c.
Top 7%
TrueBoxGuy
#2
108 c.
Top 14%
helbling
#3
114 c.
Top 21%
Natanaelel
#4
116 c.
Top 29%
tree
#5
122 c.
Top 36%
Shanethegamer
#6
129 c.
Top 50%
Alex
voytxt
#7
163 c.
Top 64%
team
Thomasdcrt
#8
174 c.
Top 71%
SephQ
#9
196 c.
Top 79%
maximec-indy
#10
218 c.
Top 86%
scpchicken
#11
255 c.
Top 93%
endevo-mschulz
#12
293 c.
Top 100%
ComputerKWasTaken