How to solve a sudoku efficiently?