class Solution:
def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:
N = len(candidates)
res = []
def helper(combo, idx, remainder):
if remainder <= 0:
if remainder == 0:
res.append(combo)
return
for i in range(idx, N):
helper(combo + (candidates[i], ), i, remainder - candidates[i])
helper((), 0, target)
return res