FastPrepValidate a Sudoku Board
Problems/Validate a Sudoku Board

Validate a Sudoku Board

ZipRecruiter logoZipRecruiter● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter full-time onsite report explicitly names Valid Sudoku: check the filled cells of a 9 by 9 board for uniqueness in each row, column, and 3 by 3 box. The report leaves out a function signature, so our version supplies it.

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[][]) → boolean

Examples

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 = true
board
012345678053..7....16..195...2.98....6.38...6...344..8.3..157...2...66.6....28.7...419..58....8..79

No 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 = false
board
012345678053..7...516..195...2.98....6.38...6...344..8.3..157...2...66.6....28.7...419..58....8..79

The 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 ZipRecruiter Onsite Interview questions

  • Restaurant Vote LeadersPHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2026
  • Sliding Window Rate LimiterOA · ONSITE INTERVIEW · Seen Oct 2022
  • Sort an Integer Array in Ascending OrderOA · ONSITE INTERVIEW · Seen Apr 2022
  • Classify an Alien Dictionary OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2022
  • Add Numbers Stored in Four-Digit ChunksONSITE INTERVIEW · Seen Nov 2021
  • Add Two Numeric Strings with CarryONSITE INTERVIEW · Seen Nov 2021
  • Expand Decimal Digits into Runs of OnesONSITE INTERVIEW · Seen Nov 2021
  • Solve a Sudoku BoardONSITE INTERVIEW · Seen Aug 2021
  • Iterate Ragged Integer Lists VerticallyONSITE INTERVIEW · Seen May 2017
  • Min StackONSITE INTERVIEW · Seen Feb 2017

Similar questions at other companies

  • Sudoku Board ValidationConfluent · PHONE SCREEN · ONSITE INTERVIEWConfluent interview questions
  • Validate Rectangular Game PiecesGoogle · ONSITE INTERVIEWGoogle interview questions
  • Set Matrix ZeroesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Query Whether an Island Size ExistsMeta · ONSITE INTERVIEWMeta interview questions
  • Check a Partly Filled Sudoku GridExpedia · ONSITE INTERVIEWExpedia interview questions
  • Cache Shared Image Pipeline PrefixesAnthropic · ONSITE INTERVIEWAnthropic interview questions
  • Number of Submatrices That Sum to TargetWhatNot · ONSITE INTERVIEWWhatNot interview questions
  • Sparse Matrix MultiplicationByteDance · PHONE SCREENByteDance interview questions
  • First Completed Mingo LineEpic · OAEpic interview questions
  • Valid SudokuVerkada · PHONE SCREENVerkada interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public boolean isValidSudoku(char[][] board) {
        // write your code here
    }
}
Checking account…