Hard

Quiz

#60 Permutation Sequence

APPROACH

The integers 1 through n produce n! unique permutations in lexicographic order. Given n and k, return the string form of the kth such permutation.

Example 1:

Input: n = 3, k = 3
Output: "213"

Example 2:

Input: n = 4, k = 9
Output: "2314"

Example 3:

Input: n = 3, k = 1
Output: "123"
1 of 4
1:00

What is the optimal approach for this problem?