You are given a 4x4 game board consisting of buttons which are either lit or unlit. The buttons are numbered 1-16, like so:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Pressing a button changes the state of that button, along with the states of the buttons to the immediate left, right, top and bottom. Pressing and holding a button, which counts as two moves, changes only the state of that individual light.
The goal of the game is to turn off all of the lights. You are given a String
board consisting of four elements, each containing four characters. Each character will be a '0' or '1', indicating whether each light is off or on, respectively. You are to return an int
indicating the least number of moves necessary to turn off all of the lights.