0
The repeated number is not being cought
write a program that transforms an invalid Sudoku box to a valid one. you should take into consideration the following cases (at least): The box may contain numbers outside the range i.e. outside [1, n x n]. The valid numbers (numbers in the range [1, n x n]) may be duplicated in the box. In this case, you should fix the matrix by eliminating the duplications of numbers that are occurring more than once, and replace them by numbers in the range [1, n x n] that have not appeared yet in the box. https://code.sololearn.com/c6VJWPgyABEV/?ref=app
1 Odpowiedź
+ 1
The logic in line 46 is causing the problem.
if (i != r && j != c) {
It is meant to skip the check when both i==r and j==c, but what really happens is it skips whenever *either* one is equal. You need to correct the logic.