Skip to content

Commit 5356af7

Browse files
committed
Removed unnecessary code from JS 39
1 parent c708d4a commit 5356af7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

javascript/39-Combination-Sum.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@
1212
function combinationSum(candidates, target) {
1313

1414
candidates.sort((a, b) => a - b);
15-
1615
const combos = [];
1716
const combo = [];
18-
const set = new Set();
19-
20-
for (const candidate of candidates) {
21-
set.add(candidate);
22-
}
23-
17+
const set = new Set(candidates);
2418
buildCombos(target);
2519
return combos;
2620

@@ -45,4 +39,4 @@ function combinationSum(candidates, target) {
4539
combo.pop();
4640
}
4741
}
48-
}
42+
}

0 commit comments

Comments
 (0)