?

Log in

entries friends calendar profile Previous Previous Next Next
For the record... - IBNeko's Journal-Nyo~!
ibneko
ibneko
For the record...
...I still hate interviews.

Especially ones that ask me to recall things like the best sorting method... :P Fucking algorithms. Especially when the last time I saw them was 3+ years ago...

That being said, I did manage to get a rather curious problem out of that interview. So, given a random number generator that can only give you 0 and 1, what's the fastest way of extracting a fair 0, 1, or 2? (err, so you have a 1/3 chance of getting 0, 1/3 chance of getting 1, 1/3 chance of getting 2.)

roll it two times:
If we get 00, 01, 10 we pick a, b, or c respectively. Otherwise, we reroll twice. Is there a better way to do this?
1 happy kitten | Leave catnip
Comments
contrasedative From: contrasedative Date: February 22nd, 2008 02:21 am (UTC) (Link)
I don't have a different answer for your random number problem.

I hate interviews too, but the technical ones are at least interesting. For me, they're fresh in my mind, since I took a required course on algorithm analysis last semester. (Stupid discrete math...) I think I screwed up a mostly behavioral-question interview with Microsoft this week. I don't know why you would hire someone based on their rehearsed 30-second sound bites. We're not politicians, we're programmers.
1 happy kitten | Leave catnip