Question DSA-REC-0043
MediumWhat is the output of this code?
def subsets(a):
if not a:
return [[]]
rest = subsets(a[1:])
return rest + [[a[0]] + s for s in rest]
r = subsets([1, 2, 3])
print(len(r), [2, 3] in r)
- A.
8 True
- B.
7 True
- C.
Sign up free to see the answer and a step-by-step explanation.