diff options
Diffstat (limited to 'progs/a737.py')
-rw-r--r-- | progs/a737.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/progs/a737.py b/progs/a737.py new file mode 100644 index 0000000..80925dc --- /dev/null +++ b/progs/a737.py @@ -0,0 +1,11 @@ +def permute_string(str):
+ if len(str) == 0:
+ return ['']
+ prev_list = permute_string(str[1:len(str)])
+ next_list = []
+ for i in range(0,len(prev_list)):
+ for j in range(0,len(str)):
+ new_str = prev_list[i][0:j]+str[0]+prev_list[i][j:len(str)-1]
+ if new_str not in next_list:
+ next_list.append(new_str)
+ return next_list
\ No newline at end of file |