diff --git a/exact_cover/wrapper.py b/exact_cover/wrapper.py index bf9d5d7..463c250 100644 --- a/exact_cover/wrapper.py +++ b/exact_cover/wrapper.py @@ -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 diff --git a/src/dlx.c b/src/dlx.c index bdb800e..9eae403 100644 --- a/src/dlx.c +++ b/src/dlx.c @@ -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; }