leetcode sudoku solver refactoring