← All problemsSign in

Island Count

A geographic region can be descriped as an $n \times n$ grid. Each square of the grid is either land (denoted as 'L') or water (denoted as 'W'). An island is defined as a group of land squares connected by some path i.e. land neighbors on the left, right, up, down (and their land neighbors and so on) but not just diagonally connected land squares. Find out the number of islands. ###Input:

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start