CT092

Lexicographic Permutations

MediumAcceptance: 0.0%

A permutation is an ordered arrangement of objects. The lexicographic permutations of 0, 1, 2 are: 012, 021, 102, 120, 201, 210. The digits 0 through 9 are arranged in lexicographic order. Given n (0-indexed), find the n-th permutation of the digits 0-9.

Example 1:

Input: 999999
Output: 2783915460

Example 2:

Input: 0
Output: 0123456789

Example 3:

Input: 3628799
Output: 9876543210

Constraints:

0 <= n <= 3628799 (10! - 1)

Tags:

math permutations combinatorics
Loading...
Test Cases:No test cases
No test cases available.
Coding Problem Not Found | CodeTikki