Approach hintTry it first, then revealHide
Run a DFS or BFS from the starting pixel over neighbours that have the original colour, recolouring as you go. Return immediately when the new colour equals the original one, or the search never ends.
Run a DFS or BFS from the starting pixel over neighbours that have the original colour, recolouring as you go. Return immediately when the new colour equals the original one, or the search never ends.