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.
解题思路:
经典的NP问题,暴力枚举即可,采用Dancing Links
可以优化算法,参考链接:https://www.ocf.berkeley.edu/~jchu/publicportal/sudoku/sudoku.paper.html
JAVA实现如下:
时间: 2024-08-07 16:36:19