Objective
The paint bucket tool of an image editor changes the colour of a square and of every connected square (horizontally or vertically) that had that same colour. It is a flood fill over a grid.
Instructions
- The first line has rows
fand columnsc; then comeflines ofccharacters (each character is a colour); and finally a line withi j colour: the square where you click and the new colour. - Show the resulting grid. If the new colour is already the one of the square, nothing changes.
3 4
1100
1010
0011
0 0 5
5500
5010
0011
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise