Skip to content

Commit 74d6832

Browse files
authored
Update 0039-组合总和.py
1 parent e3f9969 commit 74d6832

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

0039.组合总和/0039-组合总和.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:
1212

1313
ans = []
1414

15-
def find(s, use, remain):
16-
for i in range(s, len(candidates)):
15+
def find(start_idx, used, remain):
16+
for i in range(start_idx, len(candidates)):
1717
c = candidates[i]
1818
if c == remain:
19-
ans.append(use + [c])
19+
ans.append(used + [c])
2020
if c < remain:
21-
find(i, use + [c], remain - c)
21+
find(i, used + [c], remain - c) # 递归
2222
if c > remain:
2323
return
2424
find(0, [], target)

0 commit comments

Comments
 (0)