>_
num_islands.kt
Kotlin 2.4
Not run yet

+ 8 hidden

Input
grid = ["11000", "11010", "00011", "00000"]
Expected
2

The 2 x 2 block in the top left is one island; the three cells on the right, joined top to bottom and then left to right, are the other.