Problem bank

Problem 250 of 333MediumCodingP250

Fair coin from a biased coin

  1. You have a function biased() that returns 1 with some unknown probability pp, where 0<p<10 < p < 1, and 0 otherwise. Using only biased(), write fair() that returns 0 or 1 with probability 1/21/2 each. How many calls to biased() does fair() make on average when p=0.3p = 0.3?