ret =  def combinationSum3(self, k, n): self.findTuple(k, n, , 1) return self.ret def findTuple(self, k, n, tmp, start): if k<0 or n<0: return if k==0 and n==0: if sorted(tmp) not in self.ret: self.ret.append(sorted(tmp)) return for cand in range(start, 10): if cand>n: break if cand not in tmp and cand<=n: temp = copy.deepcopy(tmp) temp.append(cand) self.findTuple(k-1, n-cand, temp, cand+1)
I have encountered the same problem, and the same case : 3, 7,
my code ran well in my circumstance, but the OJ print [1,5] [2,4] [1,2,4]
I used class properties as well, but initialized it at each beginning!
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.