We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 002a743 commit 53a3fd3Copy full SHA for 53a3fd3
combination-sum/yayyz.py
@@ -0,0 +1,16 @@
1
+class Solution:
2
+ def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:
3
+ result = []
4
+
5
+ def dfs(path, total, start):
6
+ if total == target:
7
+ result.append(path[:])
8
+ return
9
+ if total > target:
10
11
12
+ for i in range(start, len(candidates)):
13
+ dfs(path + [candidates[i]], total + candidates[i], i)
14
15
+ dfs([], 0, 0)
16
+ return result
0 commit comments