Skip to content

Commit

Permalink
Use -1 not 0 as the guard value.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwg4 committed Nov 30, 2024
1 parent 6f69966 commit 5037f8d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion exact_cover/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def truncate(row):
if all(x == 0 for x in row):
return [0]
else:
if row[-1] == 0:
if row[-1] == -1:
return truncate(row[:-1])
else:
return row
Expand Down
2 changes: 1 addition & 1 deletion src/dlx.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int enumerate(list sparse_matrix, int k, int max, int *solution, int *solutions,
solutions[i] = solution[i];
}
for (int i=k; i < solution_size; i++) {
solutions[i] = 0;
solutions[i] = -1;
}
return 1;
}
Expand Down

0 comments on commit 5037f8d

Please sign in to comment.