All challenges

Algorithm challenge · DSA

Number of Islands

Difficulty

medium

Time

~30m

Format

Single

Grading

Auto-graded

#python#javascript#typescript#go#java#cpp#rust#dsa#graphs#dfs#grid
Mission file // read carefullymedium

Given a grid of 1s (land) and 0s (water), return the number of islands. An island is connected horizontally/vertically.

[[1,1,0],[1,0,0],[0,0,1]]  =>  2

Build with

numIslands(grid: int[][]) → int
PythonJavaScriptTypeScriptGoJavaC++Rust
4 tests · 1 hidden
Auto-graded on submit
Start challenge

Sign in to save your progress.