Validate 9x9 grid in one pass
AmazonSoftware Engineer · OnsiteLast updated
This interview question evaluates algorithm design, data structures, correctness, complexity, edge cases, and implementation details in a realistic interview setting. A strong answer for Validate 9x9 grid in one pass states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Given a partially filled 9x9 board using digits '1'–'9' and '.' for empty cells, determine whether the current configuration is valid under Sudoku rules (no duplicates per row, column, or 3x3 sub-box). Provide a one-pass algorithm that detects conflicts during a single scan, describe your data structures (e.g., bitmasks or hash sets), and analyze time and space complexity.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.