GraphsEvidence Contributing
Flood Fill
Recursively (or iteratively) spread a fill from a starting cell to all connected cells matching a condition.
Practice Problems: 3
Difficulty: 0 Easy·3 Medium·0 Hard
Algorithmic Intuition & Recognition
The Flood Fill technique is applied when tackling problems characterized by specific invariants in the problem state or constraints:
- Core Strategy: Recursively (or iteratively) spread a fill from a starting cell to all connected cells matching a condition.
- When to use: Look for opportunities where repeated re-computation can be replaced by maintaining monotonic properties, state windows, or relational pointers.
- Interview Signal: Demonstrating this pattern shows mastery of Graphs foundations, reducing worst-case algorithmic complexity.