/**
* 先来一些测试用例
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
*
* 6 0 0 4 0 0 0 8 0
* 0 0 1 0 0 7 9 0 6
* 0 0 9 2 0 0 4 0 0
* 0 0 5 3 1 0 2 0 0
* 0 9 0 0 0 8 0 1 0
* 0 0 3 7 0 0 5 0 0
* 0 0 6 0 0 3 1 0 0
* 7 0 8 6 0 0 3 0 0
* 0 3 0 0 0 5 0 0 2
*
* 7 2 6 9 0 4 0 5 1
* 0 8 0 6 0 7 4 3 2
* 3 4 1 0 8 5 0 0 9
* 0 5 2 4 6 8 0 0 7
* 0 3 7 0 0 0 6 8 0
* 0 9 0 0 0 3 0 1 0
* 0 0 0 0 0 0 0 0 0
* 9 0 0 0 2 1 5 0 0
* 8 0 0 3 0 0 0 0 0
*
* 8 0 0 0 0 0 0 0 0
* 0 0 3 6 0 0 0 0 0
* 0 7 0 0 9 0 2 0 0
* 0 5 0 0 0 7 0 0 0
* 0 0 0 0 4 5 7 0 0
* 0 0 0 1 0 0 0 3 0
* 0 0 1 0 0 0 0 6 8
* 0 0 8 5 0 0 0 1 0
* 0 9 0 0 0 0 4 0 0
*/
public class Test {
private static int count = 0;
private static int trys = 0;
private static int trys2 = 0;
private static long end;
private static boolean found = true;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int length = 9;
int[][] arr = new int[length][length

这篇博客介绍了一种使用Java实现递归求解数独的方法,博主分享了华为面试题中的数独题目,并提供了详细的解题思路和代码实现。通过示例展示了数独的递归解决方案,包括初始化测试用例、递归填充数字等步骤,记录了博主从开始到完成解题的全过程,以此作为大学毕业后的一个纪念。
最低0.47元/天 解锁文章
2335





