标签:style blog http color java strong io for
题目:
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character ‘.‘
.
You may assume that there will be only one unique solution.
A sudoku puzzle...
...and its solution numbers marked in red.
题解:
第一反应就是N皇后问题。就是一点点尝试着填数,不行的话就回溯,直到都填满就返回。
如果对一个格子尝试从0~9都不行,那么说明整个sudoku无解,返回false就好。
对整个棋盘所有‘.‘都填完了,那么就可以返回true了。
Reference:http://rleetcode.blogspot.com/2014/01/sudoku-solver-java.html
Sudoku Solver leetcode java,布布扣,bubuko.com
标签:style blog http color java strong io for
原文地址:http://www.cnblogs.com/springfor/p/3884252.html