HARDasked at 11 companies

Making A Large Island

A hard-tier problem at 55% community acceptance, tagged with Array, Depth-First Search, Breadth-First Search. Reported in interviews at Snap and 10 others.

Founder's read

Making A Large Island is a hard matrix problem that shows up constantly at Snap, TikTok, Meta, DoorDash, and Airbnb. You're given a grid of 0s and 1s, and you can change one 0 to a 1 to connect islands. The goal is to find the size of the largest island you can create. About half the candidates who attempt it pass, which means the other half either miss the pattern or blow the implementation. If you hit this on an OA cold and blank on the trick, StealthCoder surfaces a working solution invisible to the proctor.

Companies asking
11
Difficulty
HARD
Acceptance
55%

Companies that ask "Making A Large Island"

If this hits your live OA

Making A Large Island is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

The trap is treating this as a simple island-count problem. The real work is: identify all existing islands using DFS or BFS, store each island's size, then iterate through every 0 cell and calculate what happens if you flip it. For each 0, you union the sizes of all adjacent islands, plus 1 for the 0 itself. The naive approach loops and recalculates; the working approach precomputes island sizes and IDs, then does lookups. Union Find is elegant here but DFS-based island tracking works just as well. Most failures happen when candidates try to modify the grid in place during the flip check, or iterate inefficiently. This is the kind of problem where the second half of your solution is the real test. If you haven't drilled this exact pattern, StealthCoder is your hedge for the live assessment.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Making A Large Island recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Making A Large Island interview FAQ

Is this really asked at Meta and DoorDash, or is that outdated data?+

It's in active reports for both. Matrix and DFS/BFS problems stay evergreen at these companies because they test spatial reasoning and graph traversal simultaneously. The specific twist of 'change one 0' is their way of forcing you to think about precomputation and lookup efficiency.

What's the trick I'm missing if I can solve island-count but fail this?+

You need to precompute island IDs and sizes on the first pass, then iterate every 0 once to check adjacent islands. Most candidates try to simulate the flip inside the loop, which is slow and error-prone. Separate the 'label islands' phase from the 'test each 0' phase.

Should I use Union Find or DFS for this?+

Either works. DFS is faster to code under time pressure and easier to debug. Union Find is cleaner conceptually but requires tracking island size by root, which adds a step. Pick what you know better. Both are O(n*m) for labeling plus O(n*m) for testing.

Why does this have a 55% acceptance rate when simpler matrix problems pass more often?+

The 'change one 0' constraint adds a layer most candidates underestimate. They either miss the precomputation optimization or botch the boundary logic when checking adjacent cells. It's a medium-hard problem that looks deceptively simple.

How do I avoid off-by-one errors when checking adjacent islands?+

Use a set to track which island IDs you've already counted from adjacent cells. When you iterate neighbors of a 0, you'll see the same island ID multiple times. Only add its size once. This catches the most common edge case at companies like Airbnb and Snap.

Want the actual problem statement? View "Making A Large Island" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.