Welcome Guest
You last visited July 29, 2021, 5:31 am
All times shown are
Eastern Time (GMT-5:00)

# Amazon uses this lottery puzzle as a brain-teaser for interviewees

Mar 3, 2020, 11:38 am

Insider Buzz: Amazon uses this lottery puzzle as a brain-teaser for intervieweesRating:

Includes video report

Tech giant Amazon reportedly poses a series of logical and mathematical puzzles during the interview process in order to select the best candidates, including the following lottery scenario. Take your best shot, then scroll down for the solution.

You have 100 red balls, 100 blue balls, and 2 urns. You distribute all of the balls between both urns, placing at least 1 ball in each, you cannot place them all in the same urn. You then pick one of the urns at random, and select a ball from it. You win \$100 if you pick a red ball. With that in mind, what is the best strategy for distributing the balls, and what is your best winning percentage?

Presh Talwalkar lays out the optimal strategy in his YouTube video below.

To be in with the best chance of winning, Talwalker places 1 red ball in one of the urns, and 99 red balls and 100 blue balls in the other. That gives you a 100% probability of picking a red ball from the first urn. For the second urn, there is a 99/199 (49.7%) probability.

As you are choosing an urn at random, you are equally likely to get one of these probabilities, so your winning percentage is the average of these two cases, which is 149/199, or 74.87%.

"This intuitively seems like the best answer," says Talwalkar, "but how do we know that?" He goes on to prove the optimality of this strategy by considering other approaches. For example, distributing the balls evenly between the urns gives you a 50% chance in each case, and a 50% chance overall of picking red. In another instance, putting more red balls in one urn than another creates a far lower probability when picking from the urn with predominantly blue balls.

VIDEO: Watch the optimal solution

Prevention

16 comments. Last comment 1 year ago by KY Floyd.
 Page 1 of 2
 Sharon1000New MemberGrand Rapids michUnited StatesMember #204735February 23, 20204 PostsOffline March 3, 2020, 2:57 pmI need to hit a number. I haven't hit since 2019. Do someone have any good no. They want to share?Peace&Happiness
 VOLVO2LUVMONTGOMERY VILLAGEUnited StatesMember #125160March 26, 201224 PostsOffline March 3, 2020, 3:20 pm0888
 destinycreationSouth CarolinaUnited StatesMember #18321July 9, 20051827 PostsOffline March 3, 2020, 5:18 pm"As you are choosing an urn at random, you are equally likely to get one of these probabilities, so your winning percentage is the average of these two cases, which is 149/199, or 74.87%" I'm not very good at statistics.  Where does the 149 come from in this explanation ?
 KY FloydNYUnited StatesMember #23834October 16, 20054432 PostsOffline March 3, 2020, 6:08 pmI'm not seeing any logical reason to start with 149, so I'm pretty sure it comes from working backwards to get the effective ratio if you only had one urn to choose from.The 199 makes sense, but only as applied to the urn that has 199 balls in it. With only one red ball in one of the urns you're left with 199 balls for the 2nd urn so the numerator in the equation for that urn is 199, and the denominator is the number of red balls : 99/199. That gives us a 99/199, or 49.748743718592964824120603015075% chance of picking a red ball from that urn. Since the other urn only has the single red ball the chance of picking a red ball from it is 1 in 1 or 100%.When it's time to grab one of the balls at random there's a 50% chance you'll choose urn A and a 50% chance you'll choose urn B regardless of what you do with the balls, so the chance of picking a red ball is the average of the chance of picking it from one urn or the other. Since the chances for the two urns are are 100% and 49.748743718592964824120603015075% the average is (100% + 49.748743718592964824120603015075%) / 2 = 74.874371859296482412060301507538%Then if we work backwards, to have a 74.874371859296482412060301507538% chance of picking a red ball from an urn with 199 balls we would need to have 74.874371859296482412060301507538% * 199 balls = 149. So the 199 makes sense because the best way to sort the balls results in having 199 balls in one of the urns, and the 149 is just a mathematical construct to report the odds relative tot eh 199 balls in the one urn.
 cottoneyedjoeUnited StatesMember #197030March 28, 2019704 PostsOffline March 3, 2020, 6:30 pmQuote: Originally posted by destinycreation on March 3, 2020"As you are choosing an urn at random, you are equally likely to get one of these probabilities, so your winning percentage is the average of these two cases, which is 149/199, or 74.87%" I'm not very good at statistics.  Where does the 149 come from in this explanation ?The average of the two cases is(1/2)*(1/1) + (1/2)*(99/199) = 1/2 + 99/398 = 199/398 + 99/398 = 298/398 Reduce the fraction 298/398 by halving the numerator and denominator to get 149/199.... Sooper dooper top seekrit winning numbers: 5 16 17 24 33 52 ...
 cottoneyedjoeUnited StatesMember #197030March 28, 2019704 PostsOffline March 3, 2020, 6:36 pmGood find, Todd. I heard a very similar one for a tech or investment banking job. It's the same set up with 100 balls of each color and two urns, and the same goal of maximizing your probability of getting a red ball by coming up with an optimal distribution. But instead of letting you choose an urn at random, a computer program randomly selects the urn for you.If the urns have the same number of balls, the program will choose either urn with equal probability (i.e., one half). But if one urn has more balls than the other, the computer will choose the with more balls urn 3/4 of the time, and choose the urn with fewer balls 1/4 of the time.I will hold off on posting the solution in case anyone wants to take a stab at it.... Sooper dooper top seekrit winning numbers: 5 16 17 24 33 52 ...
 SweetRed83\$HIALEAHUnited StatesMember #192223September 14, 20189193 PostsOffline March 3, 2020, 8:35 pmQuote: Originally posted by Sharon1000 on March 3, 2020I need to hit a number. I haven't hit since 2019. Do someone have any good no. They want to share?2190219195821958I am a magnet for divine abundance in the form of money, health and happiness! Sending love and light to all my beautiful souls.♥
 oneaweekUnited StatesMember #84551December 30, 2009708 PostsOffline March 3, 2020, 9:26 pmWell.    Todd...... Who? S got.   The balls?????
 oneaweekUnited StatesMember #84551December 30, 2009708 PostsOffline March 3, 2020, 9:29 pmNo applause.    Just throw. 💰
 kao1632New ZealandMember #177451September 29, 201644 PostsOnline March 4, 2020, 2:48 amQuote: Originally posted by cottoneyedjoe on March 3, 2020Good find, Todd. I heard a very similar one for a tech or investment banking job. It's the same set up with 100 balls of each color and two urns, and the same goal of maximizing your probability of getting a red ball by coming up with an optimal distribution. But instead of letting you choose an urn at random, a computer program randomly selects the urn for you.If the urns have the same number of balls, the program will choose either urn with equal probability (i.e., one half). But if one urn has more balls than the other, the computer will choose the with more balls urn 3/4 of the time, and choose the urn with fewer balls 1/4 of the time.I will hold off on posting the solution in case anyone wants to take a stab at it.if mixed 50 red + 50 blue per urn.. prop(red) = 50%if 1 red in urn 1 and 99 red + 100 blue in urn 2p(red) = p1(1/1 x .25) + p2(99/199 x .75)= 25% + 37.31% = 62.31%
 KY FloydNYUnited StatesMember #23834October 16, 20054432 PostsOffline March 4, 2020, 12:17 pm"= 25% + 37.31% = 62.31%"You're absolutely right, if you use the same 1 and 199 split, but you can mix the balls any way you want. Do you suppose that for a non-random selection of urn there might be a different mix that give the best results? And do you suppose that even with that 3:1 bias towards one urn you might still be able to get about the same probability as with the Amazon method?I'll reserve the answer, too, but see if you can find one that includes this string: 257425. <-- That's a period, not a decimal point.
 ohiopick3OhioUnited StatesMember #3023December 14, 20034252 PostsOffline March 4, 2020, 8:19 pmI'd say, "Go look for another job?" Amazon can't pay that much per hour any ways?Just my thought.
 RanettUnited StatesMember #201957November 3, 2019926 PostsOffline March 4, 2020, 9:46 pmQuote: Originally posted by ohiopick3 on March 4, 2020I'd say, "Go look for another job?" Amazon can't pay that much per hour any ways?Just my thought.I'd give you a hundred up-votes if I could.
 ThinkMarquette, MIUnited StatesMember #20540August 20, 2005936 PostsOffline March 4, 2020, 10:19 pmI instantly thought of that solution as I read the problem but then I came up with another solution. It depends on the urns and if you have to mix the balls up. If the urns are shaped right and you don't have to mix up the balls you could put half the blue balls in the bottums of both urns and then put half the red balls on top in both the urns.  If the balls cant move around then you have a 100% chance of picking a red ball off the top of each urn! My answer would depend on the whether the balls could move around in the urns once you place them in each urn. Now I will go back and reread that and watch the video in case I missed something. Edit:  Ok,  I read it once and figured it couldn't be that easy  (1/199) so I second guessed myself with the second answer but after rereading it and watching the video the key is you pick a "Random" ball from one of the urns so I guess you are not allowed to pick one off the top of either urn. Edit Again: Todds article says "select a ball from it" while the video says pick a "random" ball...I noticed that after a third read...

 Page 1 of 2