i < j where the left element is larger than the right one: a[i] > a[j].
Given size and inversions, count the permutations of the numbers 1 to size that have exactly inversions inversions.
The answer can be huge, so return it modulo 10^9 + 7.size=3, inversions=2 → 2
[2, 3, 1] (pairs 2>1 and 3>1) and [3, 1, 2] (pairs 3>1 and 3>2) both qualify.
size=4, inversions=6 → 1
Six is the most four numbers can have, and only [4, 3, 2, 1] reaches it.
size=5, inversions=3 → 15
size=3, inversions=2
2
Run checks the first 3 tests in your browser. Submit checks all 83 tests on the server, hidden ones included.