Sudoku Solver

Hard · Backtracking · about 35 minutes

Asked at Uber, Microsoft, Apple, DoorDash, Grab, Swiggy.

Solve a Sudoku puzzle. The board is 9 strings of 9 characters each, with digits '1'–'9' for given cells and '.' for empty ones. Fill every empty cell so that each row, each column and each 3×3 box contains the digits 1–9 exactly once. Every puzzle has exactly one solution; return the solved board in the same format.

Related guides