Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

board =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Track digits seen in each row, column, and 3x3 box.

Approach

Scan the board. For each digit, compute its box index (r//3)*3 + (c//3) and check whether it already exists in that row/col/box set.

Why it works

Sudoku validity is exactly the constraint “no duplicates” per row/column/box.

Code
Loading...
Complexity
Time: O(1)
Space: O(1)
Solution
Updated: 2026-02-23

Idea

Track digits seen in each row, column, and 3x3 box.

Approach

Scan the board. For each digit, compute its box index (r//3)*3 + (c//3) and check whether it already exists in that row/col/box set.

Why it works

Sudoku validity is exactly the constraint “no duplicates” per row/column/box.

Code
Loading...
Complexity
Time: O(1)
Space: O(1)