Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2b6d9c3

Browse files
Merge pull requestchihungyu1116#6 from ignacio-chiazzo/combination-sum
combination Sum DFS Solution
2 parents6a694ae +9bc6945 commit2b6d9c3

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)

[8]ページ先頭

©2009-2025 Movatter.jp