Skip to main content
mediumBlind 75

Number of Islands

Given a 2D grid of '1's (land) and '0's (water) Count the number of islands An island is formed by connecting adjacent lands horizontally/vertically Example: [["1","1","0"],["1","1","0"],["0","0","1"]] => 2

Each unvisited land cell starts one flood fill. I count the fills, not the cells — that reframing is the whole solution.

Arrays & HashingGraphsBFS / DFS

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1Count Number of Islandsmedium
2Part 2
3Part 3

Each locked part opens in the editor once the part before it passes.

Based onLeetCode