Skip to content

Instantly share code, notes, and snippets.

@daviddamilola
Created April 11, 2021 20:29
Show Gist options
  • Save daviddamilola/8c5dd237ab00eba2ececdb067b654088 to your computer and use it in GitHub Desktop.
Save daviddamilola/8c5dd237ab00eba2ececdb067b654088 to your computer and use it in GitHub Desktop.
possible permutations of a given string
def bitStr(n, s):
if n == 1: return s
return [ digit + bits for digit in bitStr(1,s) for bits in bitStr(n- 1,s)]
print (bitStr(3,'abc'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment