From 7d4c3161a2cdb8905c8bd53159d4e0cf810ea54f Mon Sep 17 00:00:00 2001 From: Akhil Date: Wed, 2 Oct 2024 23:43:26 +0530 Subject: [PATCH] Fix for issue #1388 - correcting isSafe method in sudoku solver. --- .../code/src/com/kunal/backtracking/SudokuSolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/14-recursion/code/src/com/kunal/backtracking/SudokuSolver.java b/lectures/14-recursion/code/src/com/kunal/backtracking/SudokuSolver.java index 577ecb81d..81904a893 100644 --- a/lectures/14-recursion/code/src/com/kunal/backtracking/SudokuSolver.java +++ b/lectures/14-recursion/code/src/com/kunal/backtracking/SudokuSolver.java @@ -80,7 +80,7 @@ static boolean isSafe(int[][] board, int row, int col, int num) { // check the row for (int i = 0; i < board.length; i++) { // check if the number is in the row - if (board[row][i] == num) { + if (board[i][col] == num) { return false; } }