Every cereal box hides one toy from a set of toys, each toy as likely as any other, and you have have different ones so far. Write expected_boxes(toys, have): how many more boxes you’ll buy, on average, before you have the whole set.
A set of 6 toys, one in every cereal box, and a collector opening boxes: amber for a new toy, hollow for a repeat. Six toys, six boxes? Not even close, and the last toy alone takes a long wait. 100 collectors’ waits for each new toy rise to the last. The goal is the average number of boxes, from any start.
expected_boxes(toys, have)| toys | how many different toys the set has, each as likely to be in a box | e.g. 1 |
| have | how many different toys you have so far | e.g. 0 |
| returns | how many more boxes you'll buy, on average, to complete the set | |