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
Sort by
recency
|
7 Discussions
|
Please Login in order to post a comment
Make informed decisions with our promotional mouse mats while exploring "Choosing White Balls." These mats provide a comfortable surface for researching and comparing options for various sports or activities. Whether it's selecting the right golf balls, tennis balls, or other equipment, our mouse mats ensure you have a stable platform to note down specifications and preferences. Trust our promotional mouse mats to guide you through the process of choosing the perfect white balls for your needs.
Here is my soltuion in java, javascript, python, C, C++, Csharp HackerRank Choosing White Balls Solution
What am I missing here?
Test case: 4 2 WWBW has expected answer of 1.8333333333. The only way to get that answer based on the very limited instruction case logic is as follows: Level 1: WWBW = 1 - you can get a white ball every time. Level 2: WBW and WWB. WBW = 2/3 WWB = 1
Final answer: (2/3 + 1) / 2 (for the two row possibilities in level 2) + 1 for the original = 1.833333 Ok, cool, so far so good.
Following that logic, Test case: 5 3 WWWBW Level 1: WWWBW = 1, you can get a white ball every time.
Level 2 has two unique row possibilities: WWBW and WWWB. WWBW = 1
Level 3 for WWBW has two unique rows: WBW and WWB: WBW = 2/3 and WWB = 1 and add (2/3 + 1) / 2 to WWBW's 1 for a total of 1.91666666 for the WWBW possibility.
WWWB = 1
Level 3 for WWWB has only one unique row possibility, WWB, which is also 1.
so, WWWB has a total white ball probability of 1 + (1/1) = 2.
Then, going back up to level 1, divide both the WWBW and WWWB row totals by 2 and add to the original 1 for WWWBW for a total of 2.9166666.
But, the expected test case answer is 2.9000000000. Can anyone explain please?
Here is Choosing White Balls problem solution - https://programs.programmingoneonone.com/2021/07/hackerrank-choosing-white-balls-problem-solution.html
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 ?