Graph Theory37 sections · 1633 units
Open in Course

LeetCode 733 Flood Fill - Problem Statement

LeetCode 733

Problem: Flood Fill. Task: you are given an image (a 2D2D grid of integers). Each integer represents a color. You are given a starting coordinate (sr, sc) and a newColor. Replace the starting pixel and all connected pixels of the same color with the newColor.

This is your first application of DFS on grids. You will see how traversal translates from abstract graphs to concrete 2D2D arrays. Think of each cell as a node and each pair of adjacent same-color cells as an edge.