Logo
Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Valid Sudoku (Medium)

Problem Statement

Determine if a 9x9 Sudoku board is valid. A valid Sudoku board will hold the following conditions:

  1. Each row must contain the digits 1-9 without repetition.
  2. Each column must contain the digits 1-9 without repetition.
  3. The 9 3x3 sub-boxes of the grid must also contain the digits 1-9 without repetition.

Note:

  1. The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
  2. You need to validate only filled cells.

Example 1:

  • Input:
    [["5","3",".",".","7",".",".",".","."]
    ,["6",".",".","1","9","5",".","
    

.....

.....

.....

Like the course? Get enrolled and start learning!