Welcome Guest
Log In | Register )
You last visited August 11, 2020, 7:53 pm
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

Share this news story on Facebook
Tweet this news story on Twitter
Insider BuzzInsider 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

BbITele7neA

Prevention

We'd love to see your comments here!  Register for a FREE membership — it takes just a few moments — and you'll be able to post comments here and on any of our forums. If you're already a member, you can Log In to post a comment.

16 comments. Last comment 5 months ago by KY Floyd.
Page 1 of 2
Sharon1000's avatar - DiscoBallGlowing
New Member
Grand Rapids mich
United States
Member #204736
February 23, 2020
4 Posts
Offline
Posted: March 3, 2020, 2:57 pm - IP Logged

I need to hit a number. I haven't hit since 2019. Do someone have any good no. They want to share?

Peace&Happiness

    Avatar
    MONTGOMERY VILLAGE
    United States
    Member #125162
    March 26, 2012
    24 Posts
    Offline
    Posted: March 3, 2020, 3:20 pm - IP Logged

    0888

      Avatar
      South Carolina
      United States
      Member #18321
      July 9, 2005
      1826 Posts
      Offline
      Posted: March 3, 2020, 5:18 pm - IP Logged

      "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 Floyd's avatar - lysol avatar.jpg
        NY
        United States
        Member #23834
        October 16, 2005
        4251 Posts
        Offline
        Posted: March 3, 2020, 6:08 pm - IP Logged

        I'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.

          cottoneyedjoe's avatar - cuonvFT

          United States
          Member #197033
          March 28, 2019
          538 Posts
          Offline
          Posted: March 3, 2020, 6:30 pm - IP Logged

          "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 ...

            cottoneyedjoe's avatar - cuonvFT

            United States
            Member #197033
            March 28, 2019
            538 Posts
            Offline
            Posted: March 3, 2020, 6:36 pm - IP Logged

            Good 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$'s avatar - villiarna
              HIALEAH
              United States
              Member #192226
              September 14, 2018
              8198 Posts
              Offline
              Posted: March 3, 2020, 8:35 pm - IP Logged

              I need to hit a number. I haven't hit since 2019. Do someone have any good no. They want to share?

              219

              0219

              1958

              21958

              I am a magnet for divine abundance in the form of money, health and happiness! Sending love and light to all my beautiful souls.♥

                oneaweek's avatar - lightening

                United States
                Member #84551
                December 30, 2009
                707 Posts
                Offline
                Posted: March 3, 2020, 9:26 pm - IP Logged

                Well.    Todd...... Who? S got.   The balls?????

                  oneaweek's avatar - lightening

                  United States
                  Member #84551
                  December 30, 2009
                  707 Posts
                  Offline
                  Posted: March 3, 2020, 9:29 pm - IP Logged

                  No applause.    Just throw. 💰

                    Avatar

                    New Zealand
                    Member #177454
                    September 29, 2016
                    22 Posts
                    Offline
                    Posted: March 4, 2020, 2:48 am - IP Logged

                    Good 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 2

                    p(red) = p1(1/1 x .25) + p2(99/199 x .75)

                    = 25% + 37.31% = 62.31%

                      KY Floyd's avatar - lysol avatar.jpg
                      NY
                      United States
                      Member #23834
                      October 16, 2005
                      4251 Posts
                      Offline
                      Posted: March 4, 2020, 12:17 pm - IP Logged

                      "= 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.

                        ohiopick3's avatar - Lottery-063.jpg
                        Ohio
                        United States
                        Member #3023
                        December 14, 2003
                        4246 Posts
                        Offline
                        Posted: March 4, 2020, 8:19 pm - IP Logged

                        I'd say, "Go look for another job?" Amazon can't pay that much per hour any ways?

                        Just my thought.

                          Ranett's avatar - NBie0qv

                          United States
                          Member #201960
                          November 3, 2019
                          347 Posts
                          Online
                          Posted: March 4, 2020, 9:46 pm - IP Logged

                          I'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. Big Grin

                            Think's avatar - lightbulb
                            Marquette, MI
                            United States
                            Member #20540
                            August 20, 2005
                            879 Posts
                            Offline
                            Posted: March 4, 2020, 10:19 pm - IP Logged

                            I 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...