Valid Sudoku
Part of Practice: Beyond the Basics
You are given a 9×9 Sudoku board where each cell holds a digit character '1'–'9' or '.' for empty. Decide whether the board's current state is valid: no digit repeats within any row, within any column, or within any of the nine 3×3 boxes.
Only the filled cells matter — you are not checking whether the puzzle is solvable, just that nothing placed so far breaks a rule.
Examples
- Input:
- board row 0 = ["5","3",".",".","7",".",".",".","."], ... (a standard partially filled board)
- Output:
- true
No row, column, or 3×3 box contains a repeated digit among the filled cells.
- Input:
- same board but with board[0][0] = "8" (so column 0 and the top-left box each contain two 8s)
- Output:
- false
The 8 at the top-left conflicts with the 8 already in the top-left 3×3 box, so the board is invalid.
Hints
One at a time — struggle first, peek second.
Your thinking space — verify on LeetCode, then mark it.