classSolution:""" @param n: Given the range of numbers @param k: Given the numbers of combinations @return: All the combinations of k numbers out of 1..n """defcombine_helper(self,result,entry,n,k,index,starter):ifindex==k:# if you use entry, later if you change entry, the result will be changed.new_entry=[]forjinentry:new_entry.append(j)result.append(new_entry)returnforiinrange(starter,n+1):entry.append(i)self.combine_helper(result,entry,n,k,index+1,i+1)entry.pop()returndefcombine(self,n,k):# write your code here entry=[]result=[]ifk>norn<1:returnresultself.combine_helper(result,entry,n,k,0,1)returnresult