Question DSA-REC-0063
HardWhat is the output of this code?
def subsets_dup(a):
a.sort(); res = []
def go(i, path):
res.append(path[:])
for j in range(i, len(a)):
if j > i and a[j] == a[j - 1]:
continue
path.append(a[j]); go(j + 1, path); path.pop()
go(0, [])
return res
print(len(subsets_dup([1, 2, 2])), len(subsets_dup([2, 2, 2])))
- A.
7 4
- B.
8 8
- C.
Sign up free to see the answer and a step-by-step explanation.