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 13%
helbling
#3
114 c.
Top 20%
Natanaelel
#4
116 c.
Top 27%
tree
#5
122 c.
Top 33%
Shanethegamer
#6
128 c.
Top 40%
Lv0Sys
#7
129 c.
Top 53%
voytxt
Alex
#8
163 c.
Top 67%
Thomasdcrt
team
#9
174 c.
Top 73%
SephQ
#10
196 c.
Top 80%
maximec-indy
#11
218 c.
Top 87%
scpchicken
#12
255 c.
Top 93%
endevo-mschulz
#13
293 c.
Top 100%
ComputerKWasTaken