Log Date

Welcome to techInterview, a site for technical interview questions, brain teasers, puzzles, quizzles (whatever the heck those are) and other things that make you think!





  1. Text post

    Duel

    You find yourself in a duel with two other gunmen. you shoot with 33% accuracy, and the other two shoot with 100% and 50% accuracy, respectively. the rules of the duel are one shot per-person per-round. the shooting order is from worst shooter to best shooter, so you go first, the 50% guy goes second, and the 100% guy goes third.

    where or who should you shoot at in round 1?

    Solution

    You have 3 options to consider:

    (1) Shoot at 50% guy. Death comes with: 72% likilhood (2) Shoot at the 100% guy. Death comes with: 63.64% likihood (3) Shoot into the air (purposely miss). Death comew with 58.33% likihood.

    So, you shoot into the air and hope for the best.

    Calculations:

    The p in the probabilities below represents your probability of dying at some point if you MISS either guy in the first round. It’ll be filled in later.

    (1) if you shoot at the 50% guy and get him, you’re guaranteed to get shot the next round.

    prob of dying at some point by aiming at the 50% guy:

    (=) (33.3%)(100%)+(66.67%)*(p)

    (=) (33.3%)+(66.67%)(p)

    (2) if you shoot at the 100% guy and get him, you’re left with this geometric sum of probability of getting shot by the 50% guy at some point in the future…it converges.

    (=) [(50%)] +

    [(50%)(66.67%)(50%)] +

    [(50%)(66.67%)(50%)(66.67%)(50%)] + …

    (=) 50% * { 1 + (1/3) + (1/3)^2 + … }

    (=) 50% * {3/2)

    (=) 75%

    so, your prob of getting shot if you shoot at the 100% guy is:

    (=) (33.3%)(75%)+(66.67%)(p)

    (=) (24.75%) + (66.67%)(p)

    still crummy, but it dominates the alternative, for positive p.

    (3) What happens if you miss? ie, what’s (p)?

    if you miss, the second guy has a choice to make…does he shoot at you, or the other guy? his options:

    (1) Shoot you: if he gets you, he’s guaranteed to die on the next shot.

    if he misses, he has q chance of dying (which we’ll get later).

    (=) (50%)(100%)+(50%)(q)

    (=) (50%)+(0.5)(q)

    (2) Shoot at the 100% dude:

    If he gets the 100% guy, there some infinite sum representing his probability of getting shot by you:

    [(33.33%)] +

    [(66.67%)(50%)(33.33%)] +

    [(66.67%)(50%)(66.67%)(50%)(33.33%)] + …

    (=) 33.33% * [ 1 + (1/3) + (1/3)^2 + … ]

    (=) 33.33% * [(3/2)]

    (=) (50.0%)

    So, he chances of getting shot if he shoots at the 100% guy are:

    (=) (50%)*(50%) + (50%)(q)

    (=) (25%)+(.5)q

    No matter what q is, he’d prefer shooting the 100% guy to shooting you.

    Now, what happens if *he* misses (the 100%) guy? ie, what’s q? if he misses, then the 100% guy has to make a decision:

    (1) Shoot you:

    he’s guaranteed to get you, so his chances of dying are just 50%. (game ends after the next round…the 50% gets only one shot)

    prob of dying: 50%

    (2) Shoot the 50% guy:

    by the same logic, he’d have a 33.33% chance of death (getting shot by you).

    So, he prefers to shoot the 50% guy.

    So, q is 100% (ie, if the 50% guy misses, the 100% guy shoots him immediately). From that, we know the 50% guy’s optimal move, if everyone’s around on his first shot. He’d prefer shooting at the 100% guy to shooting at you or purposely missing.

    Now, we need to get p, which is our probability of dying if we purposely miss either guy (shoot into the air).

    We know the 50% guy shoots at the 100% guy if we miss.

    (1) With 50% probability, the 50% guy kills the 100% guy, resulting in a shootout b/w us and the 50% guy.

    (=) (50%) * [ (66.67%)*(50%) + (66.67%)*(50%)*(66.67%)(50%) + …

    (=) (50%) * [ (1/3) + (1/3)^2 + … ]

    (=) (50%) * [0.5]

    (=) (25%)

    (2) He misses him. Then, we get one shot at the 100% guy (after the 100% guy shoots the 50% guy).

    Our chances of death are:

    (50%)*(66.67%) = (33.33%)

    So, p is (25%)+(33.33%) = 58.3%

    So, again, our three choices are

    (1) Shoot at 50% guy. Death comes with:

    (=) (33.3%)+(66.67%)(p)

    (=) 72% likilhood

    (2) Shoot at the 100% guy. Death comes with:

    (=) (24.75%) + (66.67%)(p)

    (=) 63.64% likihood

    (3) Shoot into the air (purposely miss).

    (=) p

    (=) 58.33% likelihood.

    1. techinterview posted this

    Notes: 2 notes

Tumblr Theme 'Nautical' by PixelUnion