Reported September 2026
Confluentbacktracking

Sudoku Puzzle Solver

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 Confluent OA reported in September 2026 hands you a 9 x 9 Sudoku board and says fill it. Sounds like a puzzle, but it's a backtracking problem, and the naive version dies on the hard boards. If you've seen it, you know the template. If you haven't, the trick is small. Brute force without bookkeeping scans rows, columns, and boxes on every try, and that's where it gets slow or buggy. Know the pattern before you open the editor. And if you blank mid-assessment, StealthCoder sits invisibly on your screen as a safety net and gives you the working solution.

The problem

Given a partially filled 9 x 9 Sudoku board, fill every empty cell so that the completed board is valid.
Each row, each column, and each of the nine 3 x 3 sub-boxes must contain the digits 1 through 9 exactly once. An empty cell contains '.'.
The given clues are valid, and the board has exactly one solution. Return the completed board.

Function
solveSudoku(board: char[][]) → char[][]

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 = [["5","3","4","6","7","8","9","1","2"],["6","7","2","1","9","5","3","4","8"],["1","9","8","3","4","2","5","6","7"],["8","5","9","7","6","1","4","2","3"],["4","2","6","8","5","3","7","9","1"],["7","1","3","9","2","4","8","5","6"],["9","6","1","5","3","7","2","8","4"],["2","8","7","4","1","9","6","3","5"],["3","4","5","2","8","6","1","7","9"]]
The filled board contains every digit exactly once in each row, column, and sub-box.
Example 2
board = [[".","3","4","6","7","8","9","1","2"],["6","7","2","1","9","5","3","4","8"],["1","9","8","3","4","2","5","6","7"],["8","5","9","7","6","1","4","2","3"],["4","2","6","8","5","3","7","9","1"],["7","1","3","9","2","4","8","5","6"],["9","6","1","5","3","7","2","8","4"],["2","8","7","4","1","9","6","3","5"],["3","4","5","2","8","6","1","7","."]]
return = [["5","3","4","6","7","8","9","1","2"],["6","7","2","1","9","5","3","4","8"],["1","9","8","3","4","2","5","6","7"],["8","5","9","7","6","1","4","2","3"],["4","2","6","8","5","3","7","9","1"],["7","1","3","9","2","4","8","5","6"],["9","6","1","5","3","7","2","8","4"],["2","8","7","4","1","9","6","3","5"],["3","4","5","2","8","6","1","7","9"]]
The two missing corner values are forced by their rows and columns.

Constraints
board.length == 9.
board[i].length == 9.
Every cell is '.' or a digit from '1' through '9'.
The given clues obey the Sudoku rules.
The board has exactly one solution.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern is backtracking with constraint tracking. Find an empty cell, try digits 1 through 9, check that the digit isn't already in the row, column, or 3 x 3 box, place it, recurse, and undo it if the recursion fails. The edge case that breaks a naive solution is forgetting to reset the cell to '.' on backtrack, or not returning a boolean so the recursion knows to stop once the board is solved. Keep three sets of 9 (or bitmasks) for rows, columns, and boxes so each check is O(1). Box index is (r // 3) * 3 + c // 3. Better still, pick the empty cell with the fewest candidates first. The board has exactly one solution, so you can stop at the first full fill and mutate in place. If the recursion tangles on the live OA, StealthCoder is the hedge that gives you the clean version fast.

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 Puzzle Solver 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 sudoku solver. 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 Puzzle Solver FAQ

What's the trick to the Confluent Sudoku solver?+

Backtracking with O(1) validity checks. Track used digits per row, column, and box with sets or bitmasks. Place a digit, recurse, and undo on failure. Return true the moment the board is full so the recursion unwinds without overwriting the answer.

How hard is this problem really?+

It's a hard-tagged problem, but the code is short once you know the template. The difficulty is bookkeeping, not insight. Most failures come from a missing undo step or an off-by-one in the box index, not from the idea itself.

Why does my solution time out?+

You're probably rescanning the row, column, and box for every candidate digit. Precompute used-digit sets or bitmasks and update them on place and undo. Choosing the empty cell with the fewest options first also prunes the search a lot.

Do I need to return a new board or modify in place?+

The signature returns the board, but the standard approach mutates the input and returns it. Since there's exactly one solution, stop at the first complete fill. Just make sure every failed branch restores the cell to '.' first.

How do I prepare for this in 48 hours?+

Write the backtracking solver from scratch twice. First with simple row, column, and box scans, then with bitmasks. Test on Example 2, where only two cells are missing, to confirm your undo logic. Then time it on a sparse board.

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