Little Elephant and Balloons

could you please explain the 2nd test case of LEBALONS problem ?

2 1

1 4

2 7

output :
7.333333333

1 Like

Hi here its the expected value of the balloons if the number of distinc colors is 1 ,ie 1 or 2

Here is how its computed

(4 + 7 + (4+7))/2

that’s we have 3 subsets of the balloons which could satisfy the need they are

{1} {2} and {1,2}

So we have to sum up the price of each set and divide it by number of sets that’s 3

8 Likes
  • Regarding this problem, it is not specified in the text whether the balloons can have the same color. Although this may seem obvious to someone, it should be stated in the text explicitly.
4 Likes

(4+7+(4+7))/3*

1 Like

Oh #falit94 that was a typo thankyou

Does the probability of every subset would be same or it can vary due to same color of balloons??
example :
1
3 1
1 2
2 3
2 4

subsets are :
{1}{2}{2} {1,2} {1,2} {2,2} {1,2,2}
so the probability of each subset will be same or different?

i dont think dey cn hv same colour

i guess baloon probabaly could be of same colour too…otherwise there would have twice submisssion of current no of submissions.