Generate list of all possible permutations of a string

后端 未结 30 2852
故里飘歌
故里飘歌 2020-11-22 15:10

How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters.

Any l

30条回答
  •  误落风尘
    2020-11-22 15:13

    Non recursive solution according to Knuth, Python example:

    def nextPermutation(perm):
        k0 = None
        for i in range(len(perm)-1):
            if perm[i]

提交回复
热议问题