Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Sudoku Solver

XPChallenge Points: 30
levelLevel: Hard

Task:
You are given a partially filled 9x9 Sudoku board. Your task is to fill the empty cells so that the completed board satisfies these rules:


1. Each number 1-9 appears exactly once in each row.
2. Each number 1-9 appears exactly once in each column.
3. Each number 1-9 appears exactly once in each 3x3 sub-grid.


Empty cells are represented by the character '.'.

Example 1:

Input: board = [ ["8",".",".",".",".",".",".",".","."], [".",".","3","6",".",".",".",".","."], [".","7",".",".","9",".","2",".","."], [".","5",".",".",".","7",".",".","."], [".",".",".",".","4","5","7",".","."], [".",".",".","1",".",".",".","3","."], [".",".","1",".",".",".",".","6","8"], [".",".","8","5",".",".",".","1","."], [".","9",".",".",".",".","4",".","."] ]

Output: [ ["8","1","2","7","5","3","6","4","9"], ["9","4","3","6","8","2","1","7","5"], ["6","7","5","4","9","1","2","8","3"], ["1","5","4","2","3","7","8","9","6"], ["3","6","9","8","4","5","7","2","1"], ["2","8","7","1","6","9","5","3","4"], ["5","2","1","9","7","4","3","6","8"], ["4","3","8","5","2","6","9","1","7"], ["7","9","6","3","1","8","4","5","2"] ]

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result