Why my approach isn't working?

In the marbles problem, we have to choose 30 marbles and they are of 7 distinct types, so why can’t I do it like this, that I select the first k distinct marbles, that is I select for the first seven places, seven distinct, so that every type of marble should be present at least once this condition is met.
And now for the rest 23 places , for each place I have seven options , so the final answer becomes 23^7?

@deepak_four
According to your approach,
suppose one solution is RRRGR, then RRRGR and RGRRR will be treated differently. But if you read the question carefully, the final output only depends on the count of the various marbles of different colors.
You proceed by using the multinomial theorem.

As we were given 30 marbles, we removed 7 already so that now there is atleast one of each kind.

Now we have 23 marbles left and 7 different types of marbles. The total number of ways are

(23 + 7 - 1)C(7 - 1) . Where this is nCr . Just think about this once.
If my answer was able to answer your query, please mark the doubt as resolved.

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.