Problem 114. Check to see if a Sudoku Puzzle is Solved
Description:
Your task, should you choose to accept it, is to make a function that checks to see if a 9x9 matrix of integers represents a completed sudoku puzzle. For more information regarding sudokus, refer to the wikipedia page.
The function will return true only when it's a completed sudoku puzzle. A value of 0 refers to a blank entry.
Example:
input = [ 8 2 4 9 5 3 6 7 1 6 3 5 8 1 7 9 2 4 7 1 9 6 2 4 8 5 3 5 8 7 2 9 1 3 4 6 1 4 2 7 3 6 5 8 9 3 9 6 4 8 5 2 1 7 2 6 1 5 4 9 7 3 8 4 7 8 3 6 2 1 9 5 9 5 3 1 7 8 4 6 2 ]; answer = true;
input = [ 8 2 4 9 5 3 6 7 1 6 3 5 8 1 7 9 2 4 7 1 9 0 2 4 8 5 3 5 8 7 2 9 1 3 4 6 1 4 2 7 3 0 5 8 9 3 9 6 4 8 5 2 1 7 2 6 1 5 4 9 7 3 8 4 7 8 3 6 2 1 9 5 9 5 3 1 7 8 4 6 2 ]; answer = false;
Solution Stats
Problem Comments
-
5 Comments
Show
2 older comments
Asif Newaz
on 13 Nov 2019
ur test suite 6 is wrong, isn't it??
Dyuman Joshi
on 26 Dec 2020
@bmtran can you explain why test case #6 (toeplitz variation) is false?
@bmtran (Bryant Tran)
on 26 Dec 2020
In addition to each row and column needing to have 1 through 9, each 3x3 sub-region must have 1 through 9 as well.
Solution Comments
Show commentsGroup

Paper-&-pencil Games
- 19 Problems
- 4 Finishers
- Guess the number I'm thinking of (Part 1)
- Sudoku square
- Solve the Sudoku Row
- Check to see if a Sudoku Puzzle is Solved
- Sudoku Solver - Standard 9x9
- GJam 2014 China Rd B: Sudoku Checker
- Hangman (easy)
- Hangman (strategy)
- Solve the picross! (Easy)
- Solve the picross! (Hard)
- Skyscrapers - Puzzle
- Word Search Solver
- Fill-a-pix - Solution Checker
- Fill-a-pix - Solver (basic)
- Play Tic-Tac-Toe: Easy Bots
- Play Tic Tac Toe : No Losses Allowed
- Tic Tac Toe Solver
- OXO counting
- Tic-Tac-Logic - Solution Checker
Problem Recent Solvers324
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!