Skip to content

Valid Sudoku ​

Valid Sudoku — LeetCode

Determine whether a partially filled 9x9 Sudoku board is valid — no repeated digit in any row, column, or 3x3 sub-box.

Approach ​

Easy solution: For each row and column and square, init a set and check if the element exists in set or not.

Hard solution: Use a single int for each row, col and square. Use the bits to indicate if a element is seen or not.

Remarks ​