How to find permutation of k in a given length?

前端 未结 6 691
小鲜肉
小鲜肉 2020-12-05 17:01

How can I find the permutations of k in a given length?

For example:

The word cat has 3 letters: How can I find all the permutations of 2 in the

6条回答
  •  盖世英雄少女心
    2020-12-05 17:17

    What's wrong with the recursive solution and passing an extra parameter (depth) so that the recursive function returns immediately for depth > n.

提交回复
热议问题