ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://leetcode.com/problems/valid-sudoku/ |
| Last Crawled | 2026-04-05 09:58:50 (1 day ago) |
| First Indexed | 2015-03-13 15:30:37 (11 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Valid Sudoku - LeetCode |
| Meta Description | Can you solve this real interview question? Valid Sudoku - Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: 1. Each row must contain the digits 1-9 without repetition. 2. Each column must contain the digits 1-9 without repetition. 3. Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1-9 without repetition. Note: * A Sudoku board (partially filled) could be valid but is not necessarily solvable. * Only the filled cells need to be validated according to the mentioned rules. Example 1: [https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Sudoku-by-L2G-20050714.svg/250px-Sudoku-by-L2G-20050714.svg.png] 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 Example 2: Input: board = [["8","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: false Explanation: Same as Example 1, except with the 5 in the top left corner being modified to 8. Since there are two 8's in the top left 3x3 sub-box, it is invalid. Constraints: * board.length == 9 * board[i].length == 9 * board[i][j] is a digit 1-9 or '.'. |
| Meta Canonical | null |
| Boilerpipe Text | Determine if aÂ
9 x 9
Sudoku board is valid. Only the filled cells need to be validatedÂ
according to the following rules
:
Each row must contain the digitsÂ
1-9
without repetition.
Each column must contain the digitsÂ
1-9
 without repetition.
Each of the nineÂ
3 x 3
sub-boxes of the grid must contain the digitsÂ
1-9
 without repetition.
Note:
A Sudoku board (partially filled) could be valid but is not necessarily solvable.
Only the filled cells need to be validated according to the mentioned rules.
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
Example 2:
Input:
board =
[["8","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:
false
Explanation:
Same as Example 1, except with the
5
in the top left corner being modified to
8
. Since there are two 8's in the top left 3x3 sub-box, it is invalid.
Constraints:
board.length == 9
board[i].length == 9
board[i][j]
is a digit
1-9
or
'.'
. |
| Markdown | 

Debugging...
Submit
00:00:00
[Register](https://leetcode.com/accounts/signup/?next=%2Fproblems%2Fvalid-sudoku%2Fdescription%2F)or[Log in](https://leetcode.com/accounts/login/?next=%2Fproblems%2Fvalid-sudoku%2Fdescription%2F)
[Premium](https://leetcode.com/subscribe/?ref=lp_pl&source=qd)
Description
Description
Editorial
Editorial
Solutions
Solutions
Submissions
Submissions
Code
Code
Testcase
Testcase
Test Result
Test Result
[36\. Valid Sudoku](https://leetcode.com/problems/valid-sudoku/)
Medium
Topics
Companies
Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
1. Each row must contain the digits `1-9` without repetition.
2. Each column must contain the digits `1-9` without repetition.
3. Each of the nine `3 x 3` sub-boxes of the grid must contain the digits `1-9` without repetition.
**Note:**
- A Sudoku board (partially filled) could be valid but is not necessarily solvable.
- Only the filled cells need to be validated according to the mentioned rules.
**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
```
**Example 2:**
```
Input: board =
[["8","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: false
Explanation: Same as Example 1, except with the 5 in the top left corner being modified to 8. Since there are two 8's in the top left 3x3 sub-box, it is invalid.
```
**Constraints:**
- `board.length == 9`
- `board[i].length == 9`
- `board[i][j]` is a digit `1-9` or `'.'`.
Accepted
2,458,364/3.8M
Acceptance Rate
64\.3%
***
Topics
[Array](https://leetcode.com/tag/array/)[Hash Table](https://leetcode.com/tag/hash-table/)[Matrix](https://leetcode.com/tag/matrix/)
***

Companies
***
Similar Questions
[Sudoku Solver](https://leetcode.com/problems/sudoku-solver/)
Hard
[Check if Every Row and Column Contains All Numbers](https://leetcode.com/problems/check-if-every-row-and-column-contains-all-numbers/)
Easy
***
Discussion (321)
Choose a type
Comment
đź’ˇ Discussion Rules
1\. Please don't post **any solutions** in this discussion.
2\. The problem discussion is for asking questions about the problem or for sharing tips - anything except for solutions.
3\. If you'd like to share your solution for feedback and ideas, please head to the solutions tab and post it there.
Sort by:Best
No comments yet.
1
2
3
4
33
Copyright © 2026 LeetCode. All rights reserved.
12\.5K
321
142 Online
1
Ln 1, Col 1
Case 1
Case 2
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"\]\]
9
1
2
›
\[\["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"\]\]
\[\["8","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"\]\]
Source
FindHeaderBarSize
FindTabBarSize
FindBorderBarSize |
| Readable Markdown | Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated **according to the following rules**:
1. Each row must contain the digits `1-9` without repetition.
2. Each column must contain the digits `1-9` without repetition.
3. Each of the nine `3 x 3` sub-boxes of the grid must contain the digits `1-9` without repetition.
**Note:**
- A Sudoku board (partially filled) could be valid but is not necessarily solvable.
- Only the filled cells need to be validated according to the mentioned rules.
**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
```
**Example 2:**
```
Input: board =
[["8","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: false
Explanation: Same as Example 1, except with the 5 in the top left corner being modified to 8. Since there are two 8's in the top left 3x3 sub-box, it is invalid.
```
**Constraints:**
- `board.length == 9`
- `board[i].length == 9`
- `board[i][j]` is a digit `1-9` or `'.'`. |
| Shard | 99 (laksa) |
| Root Hash | 17128001481954483899 |
| Unparsed URL | com,leetcode!/problems/valid-sudoku/ s443 |