WC 7.3 Pawn Shop

You are interested in inspecting a collection of items. Sadly, they are only sold as "blind bags" where you do not know which item you will receive until you open it. The frequency of receiving each type of item is given in an integer array frequency.
Given that each item you receive is selected at random according to the given frequency, and that you will continue inspecting items until you have one of each, what is the averge number of purchases you will expect to make to have a complete collection? Note: The items are placed back in the bag each time.

Examples:
0) {1} Return = 1
There is only one item, so on your first purchase, you complete your collection.
1){2,2} Returns = 3.0
On your first purchase, you get an item you don't yet have. On your second purchase, one of two things happens (with equal probability): you either get the item you need (and thus complete your collection), or else get the same item you already have, and then have to keep buying.
Find what is the solution for collection set {1,1,100}.(answer upto 6 decimal places)

This challenge is worth 80 points.

You must be logged in to submit a solution

View ranklist for this challenge
About scoring and submission

Contact Us


Krish Shah : 9323115454

Kaustubh Khavnekar : 9769408039



Privacy Policy