leetle

Daily challenge for 2025-09-09

252. Flood Fill

Write a function solve that performs a flood fill on a 2D image. Starting at pixel (sr, sc) change all connected pixels (4-directionally) of the starting color to newColor. Return the modified image.

Example:
Input: image = [[1,1,1],[1,1,0],[1,0,1]], sr = 1, sc = 1, newColor = 2
Output: [[2,2,2],[2,2,0],[2,0,1]]

Run this challenge interactively in Python or JavaScript when the app loads.