Sudoku Board Validation
Updated
Problem statement
Given a partially filled 9 x 9 Sudoku board, return true if every filled cell obeys the Sudoku rules and false otherwise.
Each row, each column, and each of the nine 3 x 3 sub-boxes may contain each digit from 1 through 9 at most once. An empty cell contains '.'.
Check only whether the filled cells are consistent. The board does not need to be solvable.
Function
isValidSudoku(board: char[][]) → booleanExamples
Example 1
board = [["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".","8",".",".","7","9"]]return = trueNo row, column, or sub-box repeats a filled digit.
Example 2
board = [["5","3",".",".","7",".",".",".","5"],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".","8",".",".","7","9"]]return = falseThe first row contains digit 5 twice.
Constraints
board.length == 9.board[i].length == 9.- Every cell is
'.'or a digit from'1'through'9'.
More Confluent Onsite Interview questions
- Implement tail -nPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Sudoku Puzzle SolverPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Sequential Phrase Search Across DocumentsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Bounded Combination Sum with Signed CandidatesONSITE INTERVIEW · Seen Oct 2026
- Detect a Silent SensorONSITE INTERVIEW · Seen Sep 2026
- Build an Inverted Document IndexONSITE INTERVIEW · Seen Sep 2026
- Combination Sum with Unlimited ReuseONSITE INTERVIEW · Seen Sep 2026
- Word Search Across DocumentsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Windowed Key-Value MapPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2025
- Get Best PriceONSITE INTERVIEW · Seen Apr 2025
Similar questions at other companies
- Sparse Matrix MultiplicationByteDance · PHONE SCREENByteDance interview questions
- Validate Rectangular Game PiecesGoogle · ONSITE INTERVIEWGoogle interview questions
- Set Matrix ZeroesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Valid SudokuVerkada · PHONE SCREENVerkada interview questions
- Query Whether an Island Size ExistsMeta · ONSITE INTERVIEWMeta interview questions
- Game of Life on a Finite and an Infinite BoardCitadel · PHONE SCREENCitadel interview questions
- Validate a Sudoku BoardZipRecruiter · ONSITE INTERVIEWZipRecruiter interview questions
- Check a Partly Filled Sudoku GridExpedia · ONSITE INTERVIEWExpedia interview questions
- Unique Pairs in a 2D Matrix Summing to TargetAmazon · PHONE SCREEN
- Cache Shared Image Pipeline PrefixesAnthropic · ONSITE INTERVIEWAnthropic interview questions