Valid Sudoku

easy
1. You are given a 9x9 sudoku board. 2. You have to validate only the filled cells according to the following rules: a) Each row must contain the digits 1-9 without repetition. b) Each column must contain the digits 1-9 without repetition. c) Each of the 9 3x3 sub-boxes of the grid must contain the digits 1-9 without repetition. 3. The sudoku board could be partially filled. 4. The empty cells are filled with '.'. 5. main takes input board from the users. 6. This is a functional problem. 7. You have to complete the isValidSudoku function. It takes as input a 2D array of characters representing the board. It should return true if the board is valid, else should return false. 8. Don't change the code of main. Note: The given board contain only digits 1-9 and the character '.'.

Input Format

9 lines contain 9 space separated characters representing a row of the sudoku board. Input is handled for you.

Output Format

Valid if the board is valid, else Invalid Output is handled for you.

Constraints

N/A

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

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
Valid
Previous
Union Of Two Arrays
Next
Adding Array Elements

Related Questions