Bars and stars approach

hi
i understood this approach, stars and bars but plz explain this case
let you have n=10
k=5
so first i filled first 5 options now i am left with k blanks with 5 options each
for every blank there is 5 options so answer should be 5^5

You don’t have that many cases. Try for a smaller scenario, n=4,k=2.
So after assigning the ones to each, you are left with 2.
Now the possible ways according to you are 2^2.
But actually it is 3
2 0
0 2
1 1.
I don’t know if you remember but this problem is similar to find the non - negative integral solutions of an equation.
x1 + x2 + x3 + … + xk = n
Now because all xi >= 1
you subtract k from the LHS.
and the resulting solution is (n-k+k-1) C (k-1)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.