MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / helper

Method helper

LeetCode_problems/Combination Sum/Solution.py:21–29  ·  view source on GitHub ↗
(target,index,sub_list)

Source from the content-addressed store, hash-verified

19 result=[]
20 candidates.sort()
21 def helper(target,index,sub_list):
22 if target==0:
23 result.append(sub_list)
24 if target<0 or index>len(candidates):
25 return
26 for i in range(index,len(candidates)):
27 if target<candidates[i]:
28 break
29 helper(target-candidates[i],i,sub_list+[candidates[i]])
30 helper(target,0,[])
31 return result

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected