60 Permutation Sequence
1. Question
The set[1,2,3,…,n]contains a total ofn! unique permutations.
By listing and labeling all of the permutations in order, We get the following sequence (ie, forn= 3):
"123""132""213""231""312""321"
Given n and k, return the kth permutation sequence.
2. Implementation
(1) Math
3. Time & Space Complexity
Math: 时间复杂度O(n), 空间复杂度O(n)
Last updated
Was this helpful?