+ 5
Backtracking is a simple one. Let's assume you've already figured out half the missing blanks so I can show the algorithm better. You're in the middle of the board on a blank field. Fill in 1. If the board is valid, move to the next blank. If the board is invalid, increase the number by 1 and check again. If you hit 9 and the board is still invalid, go to the previous blank (which you already filled in), and increase that number by 1, go forward, and fill in 1 again.
29th Dec 2016, 2:49 PM
Schindlabua
Schindlabua - avatar