We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Choosing White Balls
Choosing White Balls
+ 4 comments Hi I tried solving the question what we are actually trying to calculate is the probablity of the white ball being select at every iteration. According to one of the test cases the excepted input was - :
6 4 BWBBBW
and the output was - : 1.8555555556
Now according to the explation let us try to solve it manually taking the following example - :
In the first iteration we would have something like this
We could either select the white ball at the second place and have the next set as - BBBBW or BWBBB(if we excluded the ball at the last place) The probablity of picking up the first white ball however would be 1/6+1/6+0+0+1/6+1/6 = 2/3 = 0.66666 Now in the next case lets suppose we picked up BBBBW The probablity of picking up a white ball here would be (2/5*1/2) - (Here 1/2 is the probablity of picking up the lot from 2 lots from 1st iteration) Similarly if picked up the other lot that would be BWBBB. The probablity of picking up a white ball again would be(2/5*1/2) Total Probablity would be the 2/3+2/5 = 16/15 = 1.06667 The excepted output is 1.8555556
Can somebdoy please explain what am I doing wrong here?
+ 1 comment Hi everyone,
I'm dealing with some precision issues. For example expected > 19.4431179137 calculated > 19.4431084624 (before formatting : 19.443108462398186) I'm not making any roundings in my calculation, and I'm using Pyton 3 ... any hints ?
+ 0 comments Facing the same problem.
No more comments
Sort 3 Discussions, By:
Please Login in order to post a comment