I am trying to solve this question, my solution involves solving a combinatorial problem as follows :
Number of arrangements of exactly k distinct elements in n slots such that each one of the elements appear at least once in the arrangement
My approach was to find the co-efficient of $x^{n-k}$ in the expansion of $(1+x+x^2...+x^{n-1})^k$. I am stuck in finding solution to this sub-question which will help me solve the priginal question.
In order to find the coefficient of $x^{n-k}$ is $(1+x+\cdots+x^{n-1})^k$, notice that it is equal to the coefficients of $(1+x+\cdots+x^{n-1}+\cdots)^k = \frac{1}{(1-x)^k}$, and it is known that $$ \frac{1}{(1-x)^k} = \sum_{n=0}^\infty \binom{n+k-1}{k-1} x^n. $$