← ALL NOTES
Math

60. Permutation Sequence

Don't enumerate permutations — compute each digit directly. Fix the first digit and exactly (n−1)! permutations follow it, all consecutive in lexicographic order. So the index of the first digit…

Loading…