《剑指offer》28题
输入abc,输出:
['a', 'b', 'c']
['a', 'c', 'b']
['b', 'a', 'c']
['b', 'c', 'a']
['c', 'b', 'a']
['c', 'a', 'b']
def get_all_char_sequence(list=['a','b','c'],i = 0):
if i == (len(list)-1):
print(list)
else:
for index,item in enumerate(list):
if index >= i:
new_list = list.copy()
new_list[i],new_list[index] = new_list[index],new_list[i]
get_all_char_sequence(new_list,i+1)