Leetcode 3193. Count the Number of Inversions
Count the permutations of [0..n-1] such that for each requirement (end_i, cnt_i) the prefix perm[0..end_i] has exactly cnt_i inversions, returning the result modulo 1e9+7. The core challenge is a combinatorics/DP counting problem: impose exact inversion counts on specified prefixes (n ≤ 300) and efficiently enumerate valid inversion sequences or prefix constructions.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.