Given a Sudoku Board configuration, check whether it is valid or not.
Input: [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
The basic idea is to check whether each row, column, and the 3×3 box is valid or not on the basis of following points:
- The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’.
- An empty Sudoku board is also valid.
- A valid Sudoku board (partially filled) is not necessarily solvable. Only the filled cells need to be validated.
Below is the implementation of above approach:
- Validity of a given Tic-Tac-Toe board configuration
- Check if the given chessboard is valid or not
- Sudoku | Backtracking-7
- Check if a king can move a valid move or not when N nights are there in a modified chessboard
- Program for Sudoku Generator
- Expected number of moves to reach the end of a board | Dynamic programming
- Expected number of moves to reach the end of a board | Matrix Exponentiation
- Minimum queens required to cover all the squares of a chess board
- Check for possible path in 2D matrix
- Check whether Bishop can take down Pawn or not
- Check whether a given matrix is orthogonal or not
- Check if a Matrix is Invertible
- Check if it is possible to move from (0, 0) to (X, Y) in exactly K steps
- Check mirror in n-ary tree
- Check if two trees are Mirror
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : rituraj_jain