Skip to content

Commit 43f4a6d

Browse files
committed
chore: rename termination flag variable
1 parent c60f537 commit 43f4a6d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

combination-sum/tolluset.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
*/
55
function combinationSum(candidates: number[], target: number): number[][] {
66
const result: number[][] = [];
7-
const dfs = (start: number, spot: number, path: number[]) => {
8-
if (spot === 0) {
7+
const dfs = (start: number, stop: number, path: number[]) => {
8+
if (stop === 0) {
99
result.push([...path]);
1010
return;
1111
}
1212

1313
for (let i = start; i < candidates.length; i++) {
14-
if (candidates[i] <= spot) {
14+
if (candidates[i] <= stop) {
1515
path.push(candidates[i]);
16-
dfs(i, spot - candidates[i], path);
16+
dfs(i, stop - candidates[i], path);
1717
path.pop();
1818
}
1919
}

0 commit comments

Comments
 (0)