Question DSA-REC-0009
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]
print(len(subsets([1, 2, 3])))
- A.
3
- B.
9
- C.
Sign up free to see the answer and a step-by-step explanation.