Created
October 24, 2015 04:46
-
-
Save karthikbgl/b9ac1f59ddd874f87e02 to your computer and use it in GitHub Desktop.
All possible combinations of substrings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
def yieldSubset(s): | |
return sorted(list(set([''.join(c) for i in range(len(s)+1) for c in itertools.combinations(s, i) if c]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment