Permutation Sequence (k-th Permutation)

Hard · Math & Number Theory · about 25 minutes

Asked at Google, Microsoft, Amazon.

The digits 1..n have n! permutations. Listing them in lexicographic order, return the k-th one (1-indexed) as a string. 1 ≤ n ≤ 9.