by 13of40 · 5y ago · 0 comments
Also, the manhole cover question was considered déclassé as early as 1999. One that was still making the rounds was...let's see if I can remember this... You have a soda machine that has three buttons, Coke, Pepsi, and Random (Coke or Pepsi). You know that your trickster coworker has swapped all of the button labels, so none of them are correct. What's the optimal strategy for getting a Coke out of the machine?
Its why I hate those things. They aren't testing analytical or creative ability, they are testing grace under pressure - a quality I have found is gained through experience.
- The highest likelihood of getting your choice with a single pick
- The least amount of money spent to guarantee getting your choice
- pepsi is coke or random
- coke is pepsi or random
- random is coke or pepsi
If you want Coke and you start with Pepsi, you'll get back Coke (1/2 + 1/2x1/2) or Pepsi (1/2x1/2). However, you could pick it and get back Pepsi 10 times in a row.
If you start by picking Random, you get back Coke (1/2) or Pepsi (1/2). If you get back Pepsi, you know
1. Random = Pepsi 2. Coke = Random (since it can no longer be Pepsi, since Random is) 3. Pepsi = Coke
So, you get back Coke on your first attempt (1/2), or you get back Coke on your second attempt (1/1).
So picking random first, then the correct one, optimizes for lowest upper bound on the number of choices to get what you want. Which is _actually_ what I meant by "The least amount of money spent to guarantee getting your choice", but didn't actually express correctly.
I prefer Pepsi to Coke, so I wouldn't attempt to get a Coke. The optimal strategy is, of course, to get a crowbar, pry the machine open and take what you want.
That's the optimal, least expensive strategy -- assuming you have access to a crowbar.
rot13:
Bcgvzny fgengrtl vf gb fryrpg "enaqbz", gura vs lbh trg n Crcfv, fryrpg "Crcfv". Gjb cerffrf znk
Nsgre fryrpgvat "Enaqbz":
* lbh trg n Pbxr (1 cerff)
* Lbh trg n Crcfv
Vs lbh trg n Crcfv, lbh xabj gung "enaqbz" vf gur ohggba juvpu nyjnlf cebqhprf n "Crcfv" (bayl "Crcfv" be "Enaqbz" pna cebqhpr n Crcfv, naq lbh xabj gur ynoryf ner jebat).
Sebz urer, lbh xabj gung gur ohggba ynoryyrq "Pbxr" pna'g cebqhpr n "Pbxr", nf gur ynoryf ner fjvgpurq. Vg pna'g cebqhpr n "Crcfv", nf jr'ir sbhaq gung ohggba, fb vg zhfg or "enaqbz".
Gurersber, cerffvat "Crcfv" ba gur frpbaq gel jvyy nyjnlf trg lbh n "Pbxr"
Regarding the other two buttons, one is random and the other is coke but their labels are pepsi and coke, giving us only two possible (order-independent) states which I'll illustrate with the format drink(label)/drink(label):
Coke(Pepsi)/Random(coke)
Coke(Coke)/Random(Pepsi)
The second case is invalid because it would require for the coke label to be correct, leaving only one possible case: the button labeled pepsi would have to give out coke.