Validate a 9×9 grid under constraints
Company: Verkada
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates the ability to perform constraint validation on a fixed-size 9×9 grid, testing skills in matrix/array handling, duplicate detection and use of simple data structures for correctness checking.
Constraints
- board always has exactly 9 rows and 9 columns
- Each board[r][c] is either '.' or a character from '1' to '9'
- Only the currently filled cells need to be validated
Examples
Input: ([['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']],)
Expected Output: True
Explanation: No filled digit repeats in any row, column, or 3×3 sub-grid.
Input: ([['5','3','.','.','7','.','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']],)