Let A = [a1,a2,...,an] be a permutation of integers 1,2,...,n.
A pair of indices (i,j), where 1<=i<=j<=n, is an inversion of the permutation A if ai>aj. We are given integers n>0 and k>=0. What number of n-element permutations contain exactly k inversions?
This is a programming problem and I am looking for a DP solution. Did anyone try this?