Skip to content

Instantly share code, notes, and snippets.

@aahnik
Created March 9, 2023 19:26
Show Gist options
  • Save aahnik/bed46da0201feebc20e572433b6014ce to your computer and use it in GitHub Desktop.
Save aahnik/bed46da0201feebc20e572433b6014ce to your computer and use it in GitHub Desktop.
def perm(suffix, prefix="") -> None:
if len(suffix) == 1:
print(prefix + suffix)
else:
for i, char in enumerate(suffix):
perm(suffix[:i] + suffix[i + 1 :], prefix + char)
perm("hello")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment