Does anyone know a simple algorithm to check if a Sudoku-Configuration is valid? The simplest algorithm I came up with is (for a board of size n) in Pseudocode
f
def solution(board): for i in board: if sum(i) != 45: return "Incorrect" for i in range(9): temp2 = [] for x in range(9): temp2.append(board[i][x]) if sum(temp2) != 45: return "Incorrect" return "Correct" board = [] for i in range(9): inp = raw_input() temp = [int(i) for i in inp] board.append(temp) print solution(board)