6 ms·
When I worked there in the early 2000's I had a friend of a friend whose fiancée graduated with a bachelor's degree in either CS or EE and applied for a develop
by 13of40 5y ago
When I worked there in the early 2000's I had a friend of a friend whose fiancée graduated with a bachelor's degree in either CS or EE and applied for a developer position. Somehow, and I struggle to understand the mechanics of this because engineering was highly compartmentalized away from the "business" parts of the business, they managed to turn her down for an engineering role and got her a job in marketing.
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?
- deleted 5y ago[deleted]
- cacois 5y agoThat was actually fun to think through for a minute. Easy, but I can see how a young me nervous at an interview might have stumbled. 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.
- csells 5y agoIt depends on your definition of optimal. If you optimize for time, then pressing each button one at a time until a Coke comes out. Plus it doesn't take any brain cells so I can get back to coding quicker. : )
- RHSeeger 5y agoYou can also optimize for - The highest likelihood of getting your choice with a single pick - The least amount of money spent to guarantee getting your choice
- goodcanadian 5y agoIf you take as given, "none of them are correct," I think both of those optimisations still start with pressing Pepsi. It is either Coke or random, so you have about a 75% chance of getting what you want on the first press.
- RHSeeger 5y agoIf none of them are correct, then - 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.
- majormajor 5y ago> 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. Why would you push it ten times in a row? If you get a Pepsi from it on your first press, you now know: - The button labeled Pepsi is actually Random (it can't be the actual Pepsi button, since none of the labels are correct, and it's also not the Coke button) - Therefore, the button labeled Coke is actually Pepsi (it can't be Coke by rule, and it's also not Random since we know where Random is now) - Therefore, the button labeled Pepsi is actually Coke (elimination) So the max is still 2 steps, but you have 75% chance of getting a Coke on the first try instead of just 50% chance. Same lower bounds, but better expected value.
- ThrustVectoring 5y agoIf you hit the Pepsi button and get Pepsi, you know it's random, so the random button has to be Coke (and Coke gives Pepsi). So picking the Pepsi button first still works in two tries - you either get a Coke all the time, get it randomly on the first try, or figure out which button gets you Coke.
- arethuza 5y agoI really think the answer for all of those kinds of questions should be "I'd use Google to find the answer". I mean who would try and solve a problem like that without searching for a solution first? Edit: http://mathpuzzlewiki.com/index.php/Soda_machine http://mathpuzzlewiki.com/index.php/Soda_machine
- voxadam 5y agoIf you're being interviewed for a job at Microsoft the answer should be "I'd use Bing to find the answer."
- packetslave 5y agoWhen I interviewed in Redmond in 2011, they actually told us this in the pre-interview orientation session!
- jimmaswell 5y agoDoes anything beat just pressing the buttons in order?
- adflux 5y agoThis is essentially the Monty Hall problem. First choice is 1/3d to be correct, if this choice is wrong, then change, because you will now improve your odds to be 1/2
- seiferteric 5y agoMaybe I am misunderstanding but the question says NONE of the labels are correct right? If so, I was thinking of it this way. If you press coke, it can only be random or Pepsi (.25?), if you press Pepsi, it can only be coke or random (.75?), if you press random it can only be coke or Pepsi (.5) (oddly this is still random 50/50 :) ). So the optimal on first try would be to press Pepsi?
- TchoBeer 5y agoThis was actually my first-glance answer. Consider that the Pepsi label can't possibly be the Pepsi button, but the other two can.
- pedrosorio 5y agoAnd if that first press fails, the Pepsi label must be the Random button, so you should press the button with the Random label as it is guaranteed to be the Coke button.
- lagadu 5y agoYou press random and taste, lets say it comes out pepsi. This means that this button has to be the pepsi button because if it was the random button then the label would be correct, like you mentioned. This settles the pepsi button. 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.
- erhk 5y agoAsk my coworker which one is coke
- nobody9999 5y ago>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? 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.