classSolution:defcombinationSum3(self,k:int,n:int) -> List[List[int]]: ans = []defbacktrack(curr,target,start):if target ==0:iflen(curr)== k: ans.append(list(curr))returnif target <0:returnelse:for i inrange(start, 10): curr.append(i)backtrack(curr, target - i, i +1) curr.pop()backtrack([], n, 1)return ans