Home > database >  Getting unknown error in SudokuSolver Backtracking problem
Getting unknown error in SudokuSolver Backtracking problem

Time:09-29

I was trying a Backtracking problem (SudokuSolver) I am getting an error which no-one could resolve or even understand. Hence I am seeking help here. The problem is as follows: enter image description here

And the main function/part of my code is: enter image description here

Here my removerow, removecol and removebox functions are removing the numbers which have already occurred in that row, column and sub-box of 3x3 respectively. The error I am getting is very long that is:

enter image description here

Can someone please help me with this? I'm stuck at it since 2 days. Ready to provide further clarification if needed. Please find the entire code here: enter image description here

NB: To be able to run the test class against your code, you need to change it like this:

if __name__ == '__main__':
    board = [[ int(ele) for ele in input().split() ] for i in range(9)]
    ans=solveSudoku(board,0,0)
    if ans:
        print('true')
    else:
        print('false')
  • Related