← Microsoft questions

Biased coin from unbiased coin function

Filed under Microsoft

Given a function f1() that returns 0 or 1 with 50% probability each, implement a function f2() that returns 0 with probability 1/3 and 1 with probability 2/3.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.