Technical Interview Question on Puzzles: The Monty Hall Puzzle

monty-hall

The Monty Hall Puzzle

doors

You are the contestant on a Game Show. There are 3 doors – say A,B and C – and behind one door is the prize of a million dollars. The prize is randomly placed and the probability of finding the prize behind any door is 1/3.

You get to pick one door and if you’ve picked the right door, you win the prize.

There’s a catch. After you’ve chosen a door, the game show host will not immediately open that particular door. The host will open another door that you did not pick and which he knows does not contain the prize. Suppose you had picked door A, and the prize is behind door B, the host will open door C and let you know that there is nothing being door C.

At this point, you will be given a choice: Do you want to stick with your original choice (door A in the example above) or do you want to choose the other unopened door (door B in this example)?

Would you switch your choice?

Do you think that switching doors would have any impact on the probability of finding the prize?

Do you think that switching doors would have no impact on your odds of winning the prize?

Do you think that the probability of finding the prize behind either door would be the same – 50%?

WRONG!!

This is a bit counter-intuitive but you should switch doors.

Probability of winning the prize:

  • Sticking to your original choice – 1/3
  • Switching to the other door – 2/3

HOW?

Simulating the Monty Hall Puzzle

Let us assume without loss of generality that the prize is behind door A.

monty-hall-simulation

Explaining the Monty Hall Puzzle

Let’s the divide the doors into two sets

Set 1: {The door you picked originally}

The Probability that the prize is in Set 1 is 1/3

Set 2: {The other two doors}

The Probability that the prize is in Set 2 is 2/3

The Host will open a door from Set 2 that does NOT have the prize, but the probability that the prize is in Set 2 still remains at 2/3.

Switching your choice to choose the remaining unopened door from Set 2 maximizes your odds of winning.

 

This content was brought to you by CodeGround Online Testing PlatformCodeGround is an online assessment and test evaluation system focused on helping Recruiters in initial screening of potential candidates from an ocean of job seekers in an automated way.

CodeGround supports Online Aptitude TestsSpoken English Communication Skills AssessmentsCoding Contests in JAVA, C, C++, Ruby, Python, JavaScript and PHP.  CodeGround also supports Automated asynchronous interviews. CodeGround Screening Tests can be used by Recruiters during campus hiring or to screen walkin candidates.

Please follow and like us:
0
Share this: