Skip to content

Commit 3c5d1bd

Browse files
committed
Fixed print formatting
1 parent e085d10 commit 3c5d1bd

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/main/java/com/thealgorithms/backtracking/NQueens.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ private static void getSolution(int boardSize, List<List<String>> solutions, int
101101
columns[columnIndex] = rowIndex;
102102

103103
// Skip current position if row or diagonal is already occupied
104-
if (OCCUPIED_ROWS.contains(rowIndex)
105-
|| OCCUPIED_DIAGONALS.contains(rowIndex - columnIndex)
106-
|| OCCUPIED_ANTI_DIAGONALS.contains(rowIndex + columnIndex)) {
104+
if (OCCUPIED_ROWS.contains(rowIndex) || OCCUPIED_DIAGONALS.contains(rowIndex - columnIndex) ||
105+
OCCUPIED_ANTI_DIAGONALS.contains(rowIndex + columnIndex)) {
107106
continue;
108107
}
109108

0 commit comments

Comments
 (0)