How to approach this problem, can please help me with the logic.Thnx
Help me with the logic
@aryan
Fill n spaces , with k colors. First select k spaces with k-different color. Now we are left with n-k spaces ,which can be filled with any of the k colors. Now to fill m-spaces by r-color with each r is infinte amount,we do thisā¦
Using a method thatās often called āstars and barsā: We draw n stars in a row to represent the cakes, and kā1 bars to divide them up. All of the stars to the left of the first bar are cakes of the first type; stars between the first two bars are of the second type;
| || | Hereās an example with n=6 and k=5. Weāre getting 2 of the first type, 3 of the second type, 0 of the third type, 1 of the fourth type, and 0 of the fifth type. In order to solve the problem, we just need to reorder the stars and bars by choosing the kā1 spots for the bars out of the n+kā1 total spots, so our answer is:
(n-1)C(k-1) = C(n-1,k-1)
hope its clear if yes dont forget to hit like and mark resolved