Question: Implement a recursive function flcodfil 1 to fill a region of a 2 D grid with a new color. The function takes four arguments: wrld
Implement a recursive function flcodfil to fill a region of a grid with a new color. The function takes four arguments: wrld and mecolor. The orld is a list of integers. where each integer represents a coloe The and coordinates specily the starting, point of the region to be filed. The mecolor is the new cabr to be used for filling.
Example:Jdef floodFill.grid, xy newColor:# Your implementation goes herepassConstraints:
The idd is a list of integers, where each intoger represents a calar.
The and coordinates specify the starting point of the repion to be filled.
The Is the new color to be used for filling.
The function should not modify the original grid, but return a new grid with the filled region.
The function should use recursion to fill the region
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
