릿코드 37- Sudoku Solver, nQueen 다시풀기
def dfs(board, empty, count): global isEnd if count == len(empty): for i in board: print(i) isEnd = True return y,x = empty[count] nums = possible(board, y, x) for num in nums: if not isEnd: board[y][x] = num dfs(board, empty, count+1) board[y][x] = 0 def possible(board, y, x): nums = [True for i in range(10)] for i in range(9): nums[board[y][i]] = False nums[board[i][x]] = False y = (y//3) * 3 ..
더보기