# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

One day while playing the Sudoku game Sheldon got an emergency call from his mother, so now he has to leave. Sheldon almost solved his Sudoku but only just `$4$`

indices were left unsolved.

As you are the best friend of Sheldon that’s why he asked you to solve the rest part of the Sudoku game. You must have to solve the Sudoku in order to keep Sheldon happy otherwise he won’t help you next time. You just need to fill up `$4$`

cells so that each row and each column have distinct digits.

**Remember that, Sheldon has just left the cells of one column or one row or one diagonal of the grid unsolved.**

**The grid consists of $4×4$ cells where it will have $4$ rows and $4$ columns.**

There will be `$4$`

rows and `$4$`

columns where each row and each column will have distinct digits `$d$`

. `$(1 \leq d \leq 4)$`

.

The unsolved column or unsolved row or unsolved diagonal will be denoted by ‘`$* $`

’.

Replace the ‘ `$*$`

’ with any digit `$d \hspace{.1cm} (1 \leq d \leq 4)$`

and each row and each column must have distinct digits. You can print any answer as you want by maintaining the conditions properly.

Input | Output |
---|---|

123* 341* 214* 432* | 1234 3412 2143 4321 |

Input | Output |
---|---|

1234 3412 **** 4321 | 1234 3412 2143 4321 |

**Let me remind you again that the grid may remain diagonally unsolved.**

94% Solution Ratio

mahdi.hasnatEarliest,

mahdi.hasnatFastest, 0.0s

mahdi.hasnatLightest, 131 kB

abid1729Shortest, 444B

Login to submit

The idea to solve this problem is very simple. In each row or each column you just have to check amo...