Limited time: AI code review, hints, mock interviews, whiteboard analysis, and all Pro features are unlocked. Enroll

Valid Sudoku

Medium

Topics
ArrayHash TableMatrix

Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be checked: each row, each column, and each 3 x 3 sub-box must contain no repeated digit 1-9. Empty cells are '.'. The board need not be solvable.

Example 1

Input:  board rows like "53..7...."
Output: true

Example 2

Input:  a board with two 8s in a column
Output: false

Constraints

  • board.length == 9
  • board[i].length == 9
  • board[i][j] is a digit 1-9 or '.'
Run ⌘' · Submit ⌘⏎
SensAI SensAI
Beta
Listening...
Tap mic to stop voice mode

Unlock AI Features

One click to activate - no payment, no credit card. Just sign in and you're in.

AI code review and hints
SensAI chat assistant
AI mock interviews
Whiteboard analysis
100% free during early access