Flood fill

0
Remix

Given an image as a grid of colors, a starting pixel and a new color, recolor the starting pixel and every pixel connected to it (up, down, left, right) that has the same original color. Write both a BFS and a DFS version, and handle the case where the new color equals the old one.

AppleTechnical phone screenLast asked Jan 2026
No answer yet. Write the first one; the best answer gets endorsed.