Search
⌘K

Leetcode 3109. Find the Index of Permutation

Given a permutation of numbers 1..n, compute its lexicographic rank (index) among all permutations. The core challenge is counting how many permutations precede it efficiently using combinatorics (factorial number system / counting smaller unused elements) rather than generating all permutations.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.