Search
⌘K

Leetcode 305. Number of Islands II

Given an initially all-water m×n grid, process a sequence of add-land operations and return the number of islands (4-directionally connected land components) after each addition. The problem requires maintaining dynamic connectivity efficiently—typically via Union-Find (disjoint set) with handling for duplicate adds and frequent merges.

Asked at:

Uber

Microsoft

Microsoft

LinkedIn

LinkedIn


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid February, 2026

Uber

Senior

Variation of this question where there would be openRestaurant() and findTotalOpenRestaurantBlocks()

Mid January, 2026

Microsoft

Microsoft

Senior

Mid January, 2026

Uber

Senior

Comments

Your account is free and you can post anonymously if you choose.