Anyways, this assignment calls for the use of recursion

in a Sudoku Solver program.

I feel that my base case and condition is correct ( you can check

the output with those test lines ) but what has me knowing

it's incorrect is that it refuses to backtrack when it finds no more

possible solutions.

Instead of clearing the space behind it, it simply terminates.

As everything on the site warns, I'm not looking for code snippets.

Just looking for guidance. I enjoy figuring these things out but

being totally lost doesn't help.

Thank you guys in advance!

I have omitted most of the code and just placed the method that's giving me issues.

The others are known to work. The (int n) parameter passed to the getSolution method

is the number of blank spaces in the sudoku puzzle.

private static int[][] getSolution(int n) { int count = 0; int row = 0; int col = 0; if(n == 0) { return grid; } //Gets position of first zero and starts from that point for(int i = 0; i < 9; i++) { for(int j = 0; j < 9; j++) { if(grid[i][j] == 0) { count++; if(count == 1) { row = i; col = j; break; } } } } //Brute forces numbers out of 1-9 that could fit the space for(int num = 1; num < 10; num++) { if(checkRow(num,row) && checkCol(num,col) && checkSubGrid(num,row,col)) { grid[row][col] = num; //Test purposes //System.out.println("Good -- " + num + " Grid: " + row + " " + col); //Recursive call return getSolution(n-1); } else { //Sets space as zero and moves onto next number grid[row][col] = 0; //Test purposes //System.out.println("Bad -- " + num + " Grid: " + row + " " + col); } } //Null value if no solution is found return null; }