Reported September 2026
Confluenthash table

Sudoku Board Validation

Reported by candidates from Confluent's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Confluent OA. Under 2s to a working solution.
Founder's read

The board is 9 x 9, fixed, so brute force isn't the problem here. Confluent reported this Sudoku validation question in September 2026, and the trap is writing three messy passes instead of one clean one. It's a hash-table problem: track what you've seen per row, column, and sub-box, and bail the moment a digit repeats. You're not solving the puzzle, only checking consistency. If you blank on the box indexing mid-assessment, StealthCoder runs invisibly on your desktop as a safety net and hands you the solution while the proctor sees nothing.

The problem

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
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
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'.

Reported by candidates. Source: FastPrep

Pattern and pitfall

One pass over all 81 cells. For each filled cell at (r, c), compute the box index as (r // 3) * 3 + c // 3. Keep nine sets for rows, nine for columns, nine for boxes. If the digit is already in any of its three sets, return false. Otherwise add it to all three. Skip '.' cells. That's O(81), effectively constant, and the space is constant too. The common pitfall is the box index formula. People write r // 3 + c // 3, which collides boxes, or they forget that the board doesn't need to be solvable, then start writing a backtracking solver. Don't. Another slip is comparing chars to ints inconsistently. Keep everything as characters. If the box math slips away under pressure, StealthCoder is the hedge during the live OA: it reads the prompt and gives you the working code so you can focus on explaining it.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Sudoku Board Validation cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as valid sudoku. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Confluent's OA.

Confluent reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Sudoku Board Validation FAQ

How hard is the Confluent Sudoku validation question really?+

Easy to medium. The logic is simple, but the box indexing trips people up under time pressure. If you know the (r // 3) * 3 + c // 3 formula, it's a ten-minute problem. Most failures come from overthinking it into a solver.

What's the trick to validating a Sudoku board?+

Use hash sets for each row, column, and sub-box, and check all three in a single pass. The sub-box index is (r // 3) * 3 + c // 3. Return false on the first duplicate, and ignore '.' cells entirely.

Do I need to check if the board is solvable?+

No. The problem says only filled cells must be consistent. A board can be valid and still have no solution. Writing backtracking here wastes time and adds bugs. Just check for duplicates in rows, columns, and boxes.

Can I do this with less memory than 27 sets?+

Yes. Use bitmasks, one integer per row, column, and box, and flip bit (digit) as you go. It's the same logic with less overhead. With a fixed 9 x 9 board, though, sets are fine and easier to read in an OA.

How do I prepare for this in 48 hours?+

Write the one-pass solution from memory twice, then test it on a board with a duplicate in a box only, since that's the case people miss. Also try a duplicate in a column. If both pass, you're ready for the Confluent version.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Confluent.

OA at Confluent?
Invisible during screen share
Get it