← Back to all problems
Medium

Valid Sudoku

Updated Feb 24, 2026

Problem

Check if a partially filled sudoku board is valid.

Constraints

board is 9x9

Examples

Example 1

Input: {"board": [["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"]]}
Output: true

Function Signature

def isValidSudoku(self, board: list[list[str]]) -> bool

How to Submit

Implement a Solution class with a isValidSudoku method.

Your method will be called with the input parameters and should return the answer.