Can you compete with GreedyDFS approach of this NP-Hard problem. Let's see! This game starts from the top left corner color as starting flood. You gotta make this flood of one color by adding the appropriate neighbour color.