Valid Sudoku
Updated
Problem statement
Determine whether a partially filled 9 x 9 Sudoku board is valid.
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. Empty cells contain ..
Validate only the filled cells; 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 filled row, column, or sub-box contains a repeated digit.
Example 2
board = [["8","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 = falseThe upper-left sub-box contains two cells with digit 8.
Constraints
board.length == board[i].length == 9.- Every cell is
.or a digit from1through9.
More Verkada Phone Screen questions
- Find the Unique User with Access to Every CameraPHONE SCREEN · Seen Nov 2026
- Host Log ParserPHONE SCREEN · Seen Sep 2026
- Common Camera Motion IntervalsPHONE SCREEN · Seen Sep 2026
- Time-Based Key-Value StorePHONE SCREEN · Seen Aug 2026
- Camera Log API SequencePHONE SCREEN · Seen Aug 2026
- Find Valid IP AddressesPHONE SCREEN · Seen Apr 2026
Similar questions at other companies
- Sudoku Board ValidationConfluent · PHONE SCREEN · ONSITE INTERVIEWConfluent interview questions
- Sparse Matrix MultiplicationByteDance · PHONE SCREENByteDance interview questions
- Game of Life on a Finite and an Infinite BoardCitadel · PHONE SCREENCitadel interview questions
- Unique Pairs in a 2D Matrix Summing to TargetAmazon · PHONE SCREEN
- Validate Rectangular Game PiecesGoogle · ONSITE INTERVIEWGoogle interview questions
- Set Matrix ZeroesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- First Completed Mingo LineEpic · OAEpic interview questions
- Query Whether an Island Size ExistsMeta · ONSITE INTERVIEWMeta interview questions
- Count 2x2 Submatrices by Black CellsTikTok · OATikTok interview questions
- Validate a Sudoku BoardZipRecruiter · ONSITE INTERVIEWZipRecruiter interview questions