border's blog

By border, history, 6 years ago, In English

Problem Link: Sudoku Solver

My code: link

Pretty straightforward problem. I tried sorting the blank points on the basis of options for a point. I also tried with simple backtracking. In both cases I got TLE.

What am I missing here?

Also, is there any way to use bits to mask which number is possible for a place(row/column/box)?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
Rev. 3   Vote: I like it +2 Vote: I do not like it

You may check this recursive solution with backtracking for the standard 9x9 Sudoku.

The solution uses Raster scan to traverse the Sudoku board, and stops when all cells have numbers that are consistent with the Sudoku rules.