Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This sounds simpler - if it works (can anyone confirm it?)

* We maintain a fair coin abstraction that contains an unfair coin. * Along with the unfair coin, we also maintain a counter 'C'. * 'C' starts from 0, counting up 1 every time the coin is flipped. * If C % 2 == 0 then we report the value of the unfair coin's toss. Otherwise, we reverse the value of the unfair coin's toss and report it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: