Regarding bars and stars method in Marbles question

In the hint of marbles question, there is a concept star and bars method.

There is another approach that came into my mind before watching the hint.

firstly, we take k marbles, (as 1 marble per category)

Now, If we take k categories as spaces. And we are left with
(n-k) marbles.

Then, we can say that, each of (n-k) marbles will have k options.

So, according to the above method, we have (n-k)^(k) ways/options.

But according to the above logic, my answer is getting wrong.

Plz tell me, where my approach is wrong.

this also considers order of selection of marbles thats why answer in larger than expected. To be more clear lets assume we are left with three marbles and k=2, so your formula considers these two cases as different while both are same!

  1. marble-1,2 of type 1 and marble-3 of type 2.
  2. marble -1,3 of type 1 and marble-2 of type 2.
    here at the end you have 2 marbles of type 1 and 1 marble of type-2 hence both are equivalent!

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.