techInterview
Answers to technical interview questions - accepting donations for dogs

 
home
faq
reading
feedback
discuss
archive
fogcreek
bug tracking
pets in ny
petfinder



*new* techInterview bible


thank your brain
save a dog's life




 

Solved by Phillip Birmingham

solution: flipping coins

Hmmm. I made a little math trick out of it. If the 'bot finds a head, it flips. If the bot finds a tail, there's a fifty percent chance this will become a head, as well.

(P_h = #heads/#coins, P_t = #tails/#coins)

So, delta h = -P_h + .5 P_t

= -(1 - P_t) + .5 P_t

= 1.5 P_t -1

Which is zero when P_t is 2/3. It's important to remember that a flip to a tail results in no change to the number of tails -- this threw me off for a second.


 



home | software development | bug tracking software | archive

[general software discussion] [dogs new york city] [Software Quality]