A Quantum-Inspired Algorithm for Solving Sudoku Puzzles and the MaxCut Problem