3109. Find the Index of Permutation
Given an array
perm
of lengthn
which is a permutation of[1, 2, ..., n]
, return the index ofperm
in the lexicographically sorted array of all of the permutations of[1, 2, ..., n]
.Since the answer may be very large, return it modulo
109 + 7
.
c++
1 |
|