DSA-Bootcamp-Java
                                
                                 DSA-Bootcamp-Java copied to clipboard
                                
                                    DSA-Bootcamp-Java copied to clipboard
                            
                            
                            
                        SudokuSolver is not checking isSafe for rows correctly.
description : In isSafe method below loop is intended to check if the number we are trying to insert is already available in the row or not. But below loop is iterating over columns and not on rows so it is checking if the number already exists in column or not instead of row.
// check the row
for (int i = 0; i < board.length; i++) {
    // check if the number is in the row
    if (board[row][i] == num) {
        return false;
    }
}
Link for code snippet : https://github.com/kunal-kushwaha/DSA-Bootcamp-Java/blob/6bc4d8bf8ac5e434ac9083e1c01210e42f2a762c/lectures/14-recursion/code/src/com/kunal/backtracking/SudokuSolver.java#L81C9-L86C10