FastPrepSudoku Puzzle Solver
Problems/Sudoku Puzzle Solver

Sudoku Puzzle Solver

Confluent logoConfluent● HardFULLTIMEPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Confluent onsite interview. The report names solving a Sudoku. It leaves out how the board is given, whether a solution is guaranteed, the interface, the examples, and the limits. Our version is about 75% the same as the reported question.

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"]]
board
012345678053..7....16..195...2.98....6.38...6...344..8.3..157...2...66.6....28.7...419..58....8..79
→
return
012345678053467891216721953482198342567385976142344268537915713924856696153728472874196358345286179
Moved or new

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"]]
board
0123456780.346789121672195348219834256738597614234426853791571392485669615372847287419635834528617.
→
return
012345678053467891216721953482198342567385976142344268537915713924856696153728472874196358345286179
Moved or new

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.

More Confluent Onsite Interview questions

  • Implement tail -nPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Sudoku Board ValidationPHONE 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

  • Sudoku SolverInMobi · PHONE SCREENInMobi interview questions
  • Solve a Sudoku BoardZipRecruiter · ONSITE INTERVIEWZipRecruiter interview questions
  • Sudoku SolverNutanix · ONSITE INTERVIEWNutanix interview questions
  • Sparse Plant Infection SimulationOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Word Search IIAmazon · ONSITE INTERVIEW
  • Choose the Next Minesweeper ActionRunloop · PHONE SCREEN
  • Rectangular K-in-a-RowDatabricks · ONSITE INTERVIEWDatabricks interview questions
  • Optimal Account BalancingPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
  • Partition a Card Deck into FifteensMeta · ONSITE INTERVIEWMeta interview questions
  • Word Break IIWex · PHONE SCREEN

Interview reports that mention this question

  • Confluent SWE OA, Coding and Design Interviews: 19 Experiences
  • Confluent Coding and System Design Questions: 33 Questions

Confluent interview experiences

  • Confluent Older Concurrency Rounds: 12 Experiences (Part 2 of 2)
  • Confluent Concurrency Interviews: 28 Experiences (Part 1 of 2)
  • Confluent File Manipulation Round (tail -n): 19 Experiences
All Confluent interview questionsSee Confluent hiring insights
Saved
class Solution {
    public char[][] solveSudoku(char[][] board) {
        // write your code here
    }
}
Checking account…