Five Rings interview question

coin flip problem