You are given an integer n and a requirements, where requirements[i] = [end_i, cnt_i] denotes that the prefix of a permutation ending at index end_i must have exactly cnt_i inversions.
An inversion in an array nums is a pair of indices (i, j) such that i j and nums[i] nums[j].
Return the number of permutations of the integers from n
Constraints:
n
requirements.length n
requirements[i] = [end_i, cnt_i]
end_i n
cnt_i
The input is generated such that there is at least one index i satisfying end_i $= $ n
The input is generated such that all end_i values are unique.
You are given an integer n and a requirements, where requirements[i] = [end_i, cnt_i] denotes that the prefix of a permutation ending at index end_i must have exactly cnt_i inversions.
An inversion in an array nums is a pair of indices (i, j) such that i j and nums[i] nums[j].
Return the number of permutations of the integers from n
Constraints:
n
requirements.length n
requirements[i] = [end_i, cnt_i]
end_i n
cnt_i
The input is generated such that there is at least one index i satisfying end_i $= $ n
The input is generated such that all end_i values are unique.