I recently ran across this interview screening question:
You have a bag that contains 10 different colors of M&Ms. There is an equal amount of each color of M&M. You do not know how many M&Ms start in the bag or are left in the bag at any given point. How many M&Ms do you have to draw to ensure that you have 1 of each of the 10 colors?
My initial thought was that it must be related to how many are left in the bag, but the interviewer was clear that you do not know how many are left in the bag.
My next thought was that you must empty the bag, since, for any number you pull, you don't know that the bag doesn't contain many times more still remaining.
For example, 55 would suffice as to ensure all 10 colors if only 60 M&Ms existed in the bag, but 55 would not suffice if there were 500, and you do not know whether there are 50, 500, or potentially many more.
Thus, it seems to me that any other answer must be a multiple or variable related to either the total number or the number remaining in the bag. However, you know neither the total number or the number remaining.
The answer I ended up giving was the only one that didn't seem to get shot down: you must empty the bag. However, the interviewer said this is incorrect, and my intuition is that there is a better answer as well, but I'm having trouble finding it.
How do you solve this problem?
My thoughts:
If there is an infinite number of M&M's then there is no solution; you can never guarantee you'd pull at least one of each colour.
For a finite number, the amount you have to take out can only be expressed with respect to the total number in the bag, and will constantly change as you have more information.
For example, once you pull the first M&M, we deduce that, at this point, you would have to claim that you need to take them all out (since there could just be 1 of each). If you pull a duplicate M&M, then the most you would need to withdraw is all but 1. Formally, at each M&M pull $p_i$ at time $i$ from a bag with $N$ M&M's in, you can claim that you would need to pull at most $N-(x-1)$ M&M's from the bag, where $x$ is the number of M&M's you have of the model colour.