Graphs is a repeated product-company interview pattern because it tests whether you can turn a brute-force idea into a predictable invariant.
Open on LeetCodeGiven a grid of land and water, count connected land components using four-directional adjacency.
A block of connected land cells counts as one island, even if it has many cells.
Try framing your own approach first. The 30 seconds you think before peeking is where learning happens.
Reveal the approach first.
Your rating tunes when this problem shows up again.