EASYasked at 7 companies

Flood Fill

A easy-tier problem at 66% community acceptance, tagged with Array, Depth-First Search, Breadth-First Search. Reported in interviews at Criteo and 6 others.

Founder's read

Flood Fill is an easy problem that shows up in live assessments at Amazon, Apple, OpenAI, and Palantir. It's not hard, but it catches people off-guard because the naive approach feels right until you realize you're reprocessing cells. The problem asks you to change a color in a region, like the paint bucket in Photoshop, which sounds simple until you're live and second-guessing whether to use DFS or BFS. With a 66% acceptance rate, most people who've seen it pass. If you haven't drilled the adjacency logic and boundary conditions, StealthCoder surfaces a working solution in seconds during your assessment.

Companies asking
7
Difficulty
EASY
Acceptance
66%

Companies that ask "Flood Fill"

If this hits your live OA

Flood Fill 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. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

Flood Fill is a graph traversal problem disguised as a paint tool. You start at a cell, mark it visited, then recursively (or iteratively) visit all adjacent cells with the original color until you hit a boundary or a different color. The trick most people miss: don't visit a cell twice. Track visited cells in a set or modify the image in-place. DFS is cleaner for interviews because it's fewer lines of code. The common failure mode is forgetting to check if the new color equals the old color before starting, or writing the recursion in a way that revisits cells and blows the stack. BFS works too but requires a queue. On test day, if the recursion depth or edge cases trip you up, StealthCoder gives you a tested implementation instantly.

Pattern tags

The honest play

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

Flood Fill recycles across companies for a reason. It's easy-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. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Flood Fill interview FAQ

Is Flood Fill still asked at FAANG companies?+

Yes. Amazon, Apple, and OpenAI all report asking it. It's a screening problem, not a final-round blocker, which means they want to see clean graph traversal code, not algorithmic novelty. 66% pass rate suggests it's a fair filter: people who can code basic DFS pass, people who panic on live assessments fail.

What's the difference between using DFS and BFS here?+

Both work. DFS is recursive and uses the call stack; BFS uses an explicit queue. DFS is shorter to write and debug under pressure. BFS is iterative, so no stack overflow risk on huge grids. For interviews, DFS is the default choice unless the interviewer explicitly asks for iterative or wants you to practice BFS.

What edge case kills most people on this problem?+

Not checking if the new color equals the original color. If you call flood fill with the same color, you'll revisit every cell forever (or hit stack limit). Add a single guard: if newColor == originalColor, return immediately. The second trap: forgetting to mark cells as visited, either via a set or by modifying the image in-place.

How does Flood Fill relate to matrix traversal in general?+

It's the foundational pattern. Once you nail DFS/BFS on a grid with visited tracking, you unlock Number of Islands, Max Area of Island, and Surrounded Regions. Flood Fill is the training wheels version. It forces you to write clean boundary checks and recursion, skills that carry to harder graph problems.

Is this problem a blocker or a screening filter in the interview loop?+

Screening filter. It's not algorithmic complexity; it's code quality and debugging under pressure. If you pass Flood Fill cleanly, the interviewer moves on. If you don't, they question whether you can code graph traversal at all, which kills momentum for the rest of the loop.

Want the actual problem statement? View "Flood Fill" 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.