【剑指offer】面试题28:字符串的排列

来源:互联网 发布:淘宝店铺发布宝贝草稿 编辑:程序博客网 时间:2024/05/22 06:38
def Permutation(data, i):if len( data ) == 0:return# i stand for the start of first partfor i in range(i, len( data ) - 1):# j stand for the start of second partfor j in range(i + 1, len( data )):# swap the items of two partdata[i], data[j] = data[j], data[i]Permutation(data, i + 1)# for next swap, we should recorver the last swapdata[i], data[j] = data[j], data[i]

0 0