0

Could anyone help to clarify what means (i,) here?

def combinationSum2(self, candidates, target):
    candidates.sort()
    table = [None] + [set() for i in range(target)]
    for i in candidates:
        if i > target:
            break
        for j in range(target - i, 0, -1):
            table[i + j] |= {elt + (i,) for elt in table[j]}
        table[i].add((i,))
    return map(list, table[target])
H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
Lin Ma
  • 9,739
  • 32
  • 105
  • 175
  • I am also confused by `[None] + [set() for i in range(target)]`, does it add two list? And how set() functions here? Thanks. – Lin Ma Nov 24 '15 at 09:31
  • Thanks Martijn, the reference is very helpful. If you could add an answer, I will mark it as answered to benefit other members of SO. :) – Lin Ma Nov 26 '15 at 00:49

0 Answers0