Created
March 9, 2023 19:26
-
-
Save aahnik/bed46da0201feebc20e572433b6014ce to your computer and use it in GitHub Desktop.
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
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