Hey stat/math geeks, quick phone screen question

Discussion in 'January And Everything After' started by Carnifex, Jan 25, 2013.

  1. Carnifex Hard Cider Gal

    Not so quick that I need an answer RIGHT NOW because I'm still on the phone. Quick in the sense that the guy wanted an answer right away.

    I recently phone screened for a development job with a major software company, who told someone to call me up for the basic technical chat, which I assumed would be do you know what OOP is, can you code this algorithm, what specifically did you do for Project X, that kind of thing. It's the control gate for an on-site interview.

    Rather than speaking with a member of that group, I got a call from a research scientist only loosely affiliated with them. After some quick chit-chat, he asked me three questions:

    1. Russian roulette. Given a revolver with 6 chambers and bullets in 2. The bullets are in consecutive chambers. If your opponent pulls the trigger and dry-fires (no bullet), which is more advantageous to you on your turn: just pulling the trigger, or spinning the cylinder and then pulling the trigger?
    2. How many dice do you need to roll at once to produce a 95% chance of rolling at least one six?
    3. Given the following sample:
    100 boys with an average of 10 absences a year and a standard deviation of 7
    50 girls with an average of 10 absences a year and a standard deviation of 6
    What is the probability of a random boy having at most 3 more days of absence than a random girl?


    The first one was interesting once I regarded it as a state space rather than basic probability. As handed to me, the gun would have the hammer on an empty chamber and 2/5 remaining chambers loaded, meaning a 40% chance of drawing a bullet. If I spin, I reset this back to 2/6 loaded, or roughly 33%. Spinning is the better move.
    With the rounds being loaded next to each other, this changes. With the hammer on an empty chamber, I have five possible state transitions: beginning of the loaded sequence (1) or beginning of an empty sequence (3). Thus I have a 25% chance of shooting myself, meaning it's better to just pull the trigger.



    The second question is basic- 16.7% chance of rolling a 6 with one die. Need to get to 95% by adding dice, so 95/16.7 is 6.58 dice, round up to 6 dice.





    The third question derailed me. I looked at it as a Gaussian overlap problem; the two distributions have overlapping tails with an associated probability. They're both within 1 standard deviation of each other. The "at most" is what knocked me off track. I understand the idea here, but I wasn't sure how to approach it. How would I go about solving this?
    This was all pencil & paper over the phone stuff- no calculators, Google, what have you. Side question- is this a useful phone screen? What does the fact that I didn't solve the third question say about my ability to write code in my specific domain, or in general? WHY ARE MY LINE BREAKS DISAPPEARING?
    Soli-chan, Elyscape and shift6 like this.
  2. Nute Already Beat BF's New Expansion

    Location:
    KC MO
    1) Spinning the chamber. Given that any pull of the trigger has a 2/6 chance of being a live round, after you've dropped the hammer on an empty chamber that goes down to 2/5. Spinning the chamber would theoretically reset that to 2/6, which is 6.66% less likely to result in shooting yourself.

    2) Six.

    3) There is no practical use for this information.
  3. Griot Despondent Fancybear

    Location:
    Raleigh, NC
    Oh, good probability problems. This will go swimmingly and last for hundreds of pages.
  4. Carnifex Hard Cider Gal

    Right, but this is affected by the fact that the two rounds are in sequence, right? If my opponent pulled on an empty chamber, I know I'm not in the loaded sequence; I may be about to start it (1 state) or hit an empty chamber (3 states). I'm not going to hit the second round given that he didn't hit the first. This is a slightly better chance than the 33% resulting from resetting the state sequence by spinning... right?

    Yeah, cake.

    True, but it needed to be answered. This was one of those questions that made me want to yell THIS IS WHY GOD GAVE US R AND MATLAB, but it wasn't that kind of interview.

    It'll piss me off if I get denied an on-site interview where I would get asked job-appropriate questions because of this.
    Elyscape likes this.
  5. Carnifex Hard Cider Gal

    Hah, some random Internet guy backs me up. So it's just the third problem I messed up.
    Soli-chan and Elyscape like this.
  6. Reldan Keeper of the Elemental Materials

    Location:
    Atlanta, GA
    For the Russian Roulette question the answer is not spinning the chamber.

    Spinning the chamber gives you a 1 in 3 chance of dying. However, the setup for the problem (an initial discharge with no bullet) means that the chamber from the previous spin stopped on 1 of the 4 possible chambers without bullets, but only 1 of these chambers would result in loading a bullet for the next shot.

    Spinning - 1 in 3 chance
    Not Spinning - 1 in 4 chance

    So you're absolutely right on #1.
    Caya and Elyscape like this.
  7. Nute Already Beat BF's New Expansion

    Location:
    KC MO
    If the cylinders are ABcdef with A and B being bullets, then a "click" means your opponent had c, d, e, or f, meaning that you have d, e, f, or A.

    Reldan is right, it actually does make a difference. Don't spin!

    See, in an interview, I would actually decline to answer on the grounds that actually asking the purpose of the information makes me a better employee and prevents unnecessary busywork.
    RyanMM and Elyscape like this.
  8. Carnifex Hard Cider Gal

    Sweet! So, Nute, want to play some Russian roulette?

    Edit: Dang, you ninja-retracted. Let's get someone else to play.
    Soli-chan and Elyscape like this.
  9. Nute Already Beat BF's New Expansion

    Location:
    KC MO
    READ THE WHOLE THREAD DORKENSTEIN.
    Soli-chan and Elyscape like this.
  10. TheTrunkDr Hard Cider Gal

    Location:
    Canada
    Who the hell are you talking to? Making shit up!
    Soli-chan, Elyscape and roBurky like this.
  11. Reldan Keeper of the Elemental Materials

    Location:
    Atlanta, GA
    The answer to #2 is 17 dice.

    To have a 95% chance of getting a specific number rolled, you need there to be less than 5% of all possible combinations of the dice that don't contain the number you want.

    This first becomes true when you roll 17 dice, where there are 16,926,659,444,736 possible combinations and 16,163,719,991,611 contain at least one six (95.59%).

    My stab at #3 is that the information given says that 68% of the boys have between 3 and 17 absences. We can assume a random girl has 10 absences, so we're looking for the chance that a boy would have 13 or less. 11/14th of the 68% within a standard deviation of the mean fit that criteria, and if you assume an even distribution above and below for the remaining 32% I'll count half of those (16%) being below, so let's say 16% + 11/14(68%) = 69.4%.
    Caya, Elyscape and JoshV like this.
  12. Jason McCullough Keeper of the Elemental Materials

    Christ what a terrible phone screen. What are they looking for, head random number generator?
    Kildorn, Soli-chan, Caya and 4 others like this.
  13. JoshV Keeper of the Elemental Materials

    Ah, I thought the answer to number 2 was more involved then it first appeared. That makes sense. But that seems like a bit of a nightmare to calculate over the phone.

    Was this for a very statistics heavy position?
  14. shift6 Magister Mundi Elyscape

    TELL ME YOU DID NOT SAY THIS

    (alternate post: PHONE SCREEN FAIL)
    MulMizu and Elyscape like this.
  15. Carnifex Hard Cider Gal

    5.68 rounded up to 6, typo.
    MulMizu and shift6 like this.
  16. Carnifex Hard Cider Gal

    Computer vision software development. The field is related to machine learning in the sense that they're both AI, but this is way out of left field.
  17. Talisker Despondent Fancybear

    Location:
    Childhood's End
    By your logic, you could roll 10 dice and have a 167% chance of rolling a six. Think about that for a moment.

    Hint: that's not how probability works.
    Elyscape likes this.
  18. Reldan Keeper of the Elemental Materials

    Location:
    Atlanta, GA
    Well, it either works that way or it doesn't, so I'm going to go with a 50/50.
    salwon, Hanzii, Caya and 5 others like this.
  19. Carnifex Hard Cider Gal

    Shit, you're right. What's the answer then?
  20. JoshV Keeper of the Elemental Materials

    Look up thread at Reldan's answer.
  21. Talisker Despondent Fancybear

    Location:
    Childhood's End
    odds of not rolling a six...
    ...on one die: 5/6
    ...on two dice: 5/6 * 5/6
    ...on three dice: 5/6 * 5/6 * 5/6
    ...etc

    (5/6) ** 16 == 0.054
    (5/6) ** 17 == 0.045 <--- there's your answer
    Caya and Elyscape like this.
  22. jeffd Armchair Designer

    Location:
    Oakhurst, NJ
    agreed; that's a useless phone screen.
    RyanMM likes this.
  23. Carnifex Hard Cider Gal

    Yeah, I get it...that's a bit much for a no-calculator quiz though.
    Elyscape likes this.
  24. Reldan Keeper of the Elemental Materials

    Location:
    Atlanta, GA
    You couldn't calculate 5^17 and 6^17 in your head and divide them? NO JOB FOR YOU!
    Elyscape likes this.
  25. Meserach Despondent Fancybear

    Location:
    Blighty
    Another way to look at Reldan's answer:

    The probability of not rolling a 6 on one dice is 5/6. Hence the probability of not rolling a 6 on n dice is (5/6)^n. You want that probability to be 0.05 or less, and you get there when n=17, and not before.

    EDIT: Scooped by Talisker.
  26. Carnifex Hard Cider Gal

    Disappointing. I can't believe that's the screen for a development job.

    Thanks for the info, guys.
    Elyscape likes this.
  27. SpoofyChop Armchair Designer

    Location:
    Pennsylvania
    I walked out of the only interview where the idiots on the other side of the table decided to throw stupid probability questions at me. It's basically just a nerd pissing contest that I refuse to piss in.
    Caya, Nute, shift6 and 1 other person like this.
  28. JoshV Keeper of the Elemental Materials

    Look at it another way, would you want to work at place that stresses those things as being important? So important that they only hire people who can do them?
  29. Ezdaar Beer

    Location:
    San Jose, CA
    I ask a very simple probability question on phone screens, but it is for an applied science position that focuses on machine learning so I figure it's fair game. The first two questions you had don't seem so bad, the third is a bit interesting. I've interviewed people here for positions outside my group and I leave the probability questions out in that case.
    Elyscape likes this.
  30. JoshV Keeper of the Elemental Materials

    In some ways Computer Vision could have a lot of machine learning involved. So I guess in that case, I could see the questions being more valid. The second question, if the interviewer just wanted the person to realize the answer was more than six, I could see it being a bit more fair. Did they specifically state no calculator? Because I find that to be a strange thing to test, considering computers all have calculators. Some phone interviews they expect you to do some light math on a piece of paper/notepad/calculator, which would make me less annoyed at question number 2. Number 3 would've stumped me, but I'm not a huge probabilities guy beyond D6's from playing too many tabletop games.
    Elyscape likes this.
  31. Carnifex Hard Cider Gal

    A fair point, but I think I'm competitive about it- I hate "losing" on interviews, especially the puzzle ones that seem to be trendy these days.



    Yeah...when I hit #2, I asked if I could grab a calculator just to speed things up. He told me that a calculator was against the spirit of the interview and he really would prefer that I didn't use one. Not that it would've helped me in this case, but...

    When I was slogging through #3, the interviewer offered some tips and in one case caught a dumb arithmetic error I made in calculating standard deviation. He never said anything about my flawed approach to #2. I wonder if he just wrote it off as beyond salvageable.

    Ezdaar, what question do you like to ask for the screens?
    Elyscape likes this.
  32. shift6 Magister Mundi Elyscape

    Not to defend the interviewer, but this is revealing. Perhaps the answers weren't as important as thinking aloud how you might solve the questions. In other words, the phone screen may have been against your process rather than your ability to mentally calculate standard deviations on demand.

    When I was beginning my path into BI/analytics, I'd get interview questions on how I'd approach some arbitrary question; not to test if I could rattle off impeccable SQL and not to test my arbitrary ability to know that industry's standard data frames, but to hear aloud how I thought through linking, comparing, or tallying information and presenting the result.
    Carnifex, Elyscape and JoshV like this.
  33. Ezdaar Beer

    Location:
    San Jose, CA
    Generally something related to Bernoulli trials. Simple enough that you can puzzle it out from a base case and understanding of independence.
    Elyscape likes this.
  34. Jason McCullough Keeper of the Elemental Materials

    I'm just shocked they couldn't be bothered to put them in the form of an actual practical question.
    Soli-chan and Elyscape like this.
  35. Reldan Keeper of the Elemental Materials

    Location:
    Atlanta, GA
    You're playing Risk against the Devil for the fate of humanity. He has 3 defenders in a crucial region. How many attackers do you need to bring to stand at least a 95% chance of taking the territory?
  36. FerdieLance Beardy Magnificence

    My approach to the third:

    Okay, to get the standard deviation of a difference here, we can use a simple trick: variances add, even when standard deviations don't. We do NOT, as far as I can tell, need to take into account the different sample sizes for boys and girls, since we aren't actually getting the variance of a combined sample. We're comparing randomly chosen individuals from each pool. So the 50 and 100 numbers are red herrings.

    Let's square 6 and square 7 to get the variances for boys and girls - that's 36 and 49. Then add them - that's 85. Then we take the square root, which I'll round to 9 since I don't have a calculator.

    Okay, that's my standard deviation. My mean difference is zero, since the two samples have equal averages...

    Huh. What are the odds of a random boy being AT most a third of a standard deviation above a random girl in absences? Given the shape of a bell curve, I'd say it's actually pretty close to 50%. In fact, the odds of a random boy being absent at most 9 days more than a random girl is only about 70% or so. This is counterintuitive, but taking a difference throws in a lot of variation!

    Edit: given that these tend towards trick questions, I look forward to the post that shows how I got it wrong. But my logic is: the distributions overlap so much that, to an order of magnitude, you might as well ask, "what are the odds of a random boy having, at most, zero more sick days than a random girl?"

    For the second, I can say, assuming my brain hasn't melted: "I need to solve (5/6)^x < .05. Okay. I'll use rounding to estimate a rough answer. 5 cubed is 125. 6 cubed is 216. Hmm. I want to get to a convenient fraction, like 1/2. 125/216 is getting there. Maybe once more? Multiply by 5/6 again for 625/1200something. That's 5/6 ^ 4. Okay, that's really close to 1/2. Now, 1/2 times 1/2 times 1/2 times 1/2 is about 1/16, which is arooooound 1/20. Let's say it's that, times another 5/6. So 5/6 ^ (4*4 + 1)

    5/6 to the 17th

    So maybe 17 rolls?

    If they're even remotely sane, they'll accept off-the-cuff estimates if you justify them.

    Edit: for the first, pull the trigger. To maximize your odds, point the gun at your opponent first.
    Soli-chan and Elyscape like this.
  37. Carnifex Hard Cider Gal

    Guys, please quit answering the second question correctly. Think of the moral support you'd be offering if you all made the same mistake I did.

    FerdieLance, that's a good way to look at the second and third questions. I have no idea if it's correct, but it's logical.
    Soli-chan and Elyscape like this.
  38. FerdieLance Beardy Magnificence

    Yeah, the thing is, my guess is they want to see if you can make an estimate and defend it. The ideal answer for three might very well be:

    "Well, given how much those distributions overlap, and the size of the standard deviations, I'd guess that the standard deviation of the difference is about 10 or so. So 3 is way smaller than that... so it's almost as if you asked whether or not a random boy would be the same height or shorter. So about half the time. If you want more details, we can work through the math, but it shouldn't be that far off."

    For two, if the answer I gave is still too much computation to do on the fly (it does require some calmness), there's always the trick of setting bounds. Like, "I know it's more than 10 and less than 20." This establishes that you can at least get partway there.

    That said, these things aren't nearly as good a test of reasoning and the ability to explain oneself as context-rich problems. Anyway! If I were recruiting, I know what questions I'd ask in phone screens to get the kind of employees I want!

    (OLD CHESTNUT AHEAD)

    1. How do you get an elephant in a box? Please provide a step-by-step protocol with no wasted materials.


    2. How do you get a giraffe in a box? Please provide a step-by-step protocol with no wasted materials.
    3. The Lion King is holding a conference, and all of the animals come... except for one. Which animal couldn't make it, and why not?
    4. You're standing next to a river that crocodiles use to hunt game. You have no boat or other equipment. How can you cross safely, and why?
    These are at LEAST as valid as the math ones... though I anticipate that Soli-chan will be my only employee.
    Soli-chan, NyimaR, Alligator and 6 others like this.
  39. Elyscape Already Beat BF's New Expansion

    Location:
    San Jose, CA
    The trick is to ask those questions each separated by a few minutes of other stuff.
    Soli-chan and FerdieLance like this.
  40. Reldan Keeper of the Elemental Materials

    Location:
    Atlanta, GA
    The thing with two is that there's a blatantly wrong answer, even though the right answer is ridiculous to work out without a calculator. Getting it wrong demonstrates a lack of understanding of probability and confidence intervals. I don't necessarily think it's a bad question if the goal is to see whether the candidate at least can get into the ballpark of the right answer by showing they know how to solve such a problem even if they can't do the math in their head to get the exact answer.

    The first question is also pretty good as it's a rework of the Monty Hall problem which tends to test for whether people can look past the "intuitive" answer and do some actual analysis.
    QuantumBit, shift6 and Elyscape like this.