Skip to content

Commit 2b6d9c3

Browse files
Merge pull request #6 from ignacio-chiazzo/combination-sum
combination Sum DFS Solution
2 parents 6a694ae + 9bc6945 commit 2b6d9c3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

39 Combination Sum.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ var comb = function(cand, index, partial, partialSum, target, results) {
7575
if(cand.length === index || partialSum > target) {
7676
return;
7777
}
78-
79-
comb(cand, index + 1, partial, partialSum, target, results);
80-
comb(cand, index, partial.concat([cand[index]].concat([cand[index]])),
81-
partialSum + 2* cand[index], target, results);
82-
comb(cand, index + 1, partial.concat([cand[index]]),
78+
comb(cand, index, partial.concat([cand[index]]),
8379
partialSum + cand[index], target, results);
80+
comb(cand, index + 1, partial, partialSum, target, results);
8481
};

0 commit comments

Comments
 (0)