Relative Content

Tag Archive for javascriptalgorithmsudoku

Sudoku Solvable?

Is it possible to check whether a sudoku is solvable or not. I recently tried leetcode-36. But it only checks if the sudoku was valid, but i want to check for its solvability.
I designed a algorithm using backtracking, it checks for its validity and then solves the sudoku. For example if I gave sudoku that is unsolvable but is valid, it would check all 9^81 possibilities and then conclude it is not solvable. 9^81 is a huge number and my taking lots of time to give the result that sudoku is unsolvable.
For example check this sudoku, which is valid but unsolvable.
I want to know whether there is any algorithm that checks for sudoku to be solvable, or any such optimizations in backtracking that can be made to solve this issue.