diff --git a/misc/sudokusolver.c b/misc/sudokusolver.c new file mode 100644 index 00000000..30dc4ad9 --- /dev/null +++ b/misc/sudokusolver.c @@ -0,0 +1,77 @@ +//recursion problem : Sudoku Solver +/*You are given an incomplete N*N Sudoku and asked to solve it using the following recursive algorithm: +(1) Scan the Sudoku from left to right row-wise to search for an empty cell. +(2) If there are no empty cells, print the Sudoku. Go to step 5. +(3) In the empty cell, try putting numbers 1 to N while ensuring that no two numbers in a single row, column, or box are same. Go back to step 1. +(4) Declare that the Sudoku is Invalid. +(5) Exit.*/ + +#include + +const int M=144; +int N, R, C; + +int OKrow(int a[M], int x, int y, int v) { + int j; + for(j=0; j