Apple Interview Question
SDE1sCountry: United States
Double check the question. It doesn't mention flipping~
Although I think it should. Then you get the right answer.
I doesn't say that we can't flip coins either. If it mentioned flipping then it would suggest the solution. I believe it is not the intention of the interviewer to give tips in the question.
Shove all 100 coins from table to the floor. Pick them up Head or Tail position that they fall down as. You will be able to tell if it is head or tail as you feel them when you pick them up. Place in 2 piles of 50 coins with 25 Heads and 25 Tails.
Alternatively you can just separate 50 coins on the floor, statistically you will be correct.
Split coins on two groups.
G1 = 10 coins; G2 = 90 coins
Coins can be distributed among the groups as follows
So flip either group and then number heads should be equal.
- thelineofcode January 31, 2014