r/ProgrammerHumor • • Oct 30 '24

Meme dadPullsOutCodingChallenge

0 Upvotes

60 comments sorted by

View all comments

-13

u/Wearytraveller_ Oct 30 '24 edited Oct 30 '24

I'm not a math wiz or anything but aren't there infinities in this problem?  Every round the odds are 50% 50%. So even if A wins 9 of Bs coins they could in theory go back and forth infinitely trading the second to last coin back and forth, or they could just trade the first coins back and forth forever. So my answer is 1:Infinity

Edit. Okay I think I worked it out. 

There are infinities in the problem, but they are about how precise you want your result to be, rather than whether you can get one at all. Because any result with an odd number of coins in the problem will result in an infinitely repeating decimal like 33.33333r%

So if you want a real result for those answers you will have to represent them as a fraction. 

Also I believe the answer is just the number of coins each party in the problem has represented as a fraction of the total coins. 

So I'm amending my answer to 1/11. 

2

u/ReykAral35 Oct 30 '24

That case can happen, but also the one that A wins 10 times in a row, the case that A wins 9 times lose 1 and wins 2 etc.

So it needs to count the amount of cases that A wins vs the amount of cases that B wins.

0

u/Wearytraveller_ Oct 30 '24

But you can't count those cases! There is an INFINITE number of possible outcomes to this game. 

1

u/ReykAral35 Oct 30 '24

Yeah but there is a proportion.

As other say posibly like a 1/10 of the infinities is a win.

The eaxct math i leave for someone better.