Optimized sudoku solver