You are viewing a single comment's thread. Return to all comments →
Python oneliners:
from itertools import combinations def solve(s): return sorted(''.join(x) for r in range(1,1+len(s)) for x in combinations(s,r))
Or for the fun to use accumulate instead of range(len()):
accumulate
range(len())
from itertools import combinations, accumulate def solve(s): return sorted(''.join(x) for r in accumulate(s) for x in combinations(s,len(r)))
Seems like cookies are disabled on this browser, please enable them to open this website
Building a List
You are viewing a single comment's thread. Return to all comments →
Python oneliners:
Or for the fun to use
accumulate
instead ofrange(len())
: