Question: If the goal is to drive across a one-mile bridge in one minute – and you’ve already driven across the first half of the bridge at the speed of 30 MPH – how fast do you need to drive across the second half of the bridge in order to make your goal of one … Continue reading Crossing the Bridge

# Month: October 2017

# Clock

Suppose I have a 10-digits lock. The lock has the following rule: The first digit of the code is the number of occurrences of the digit '0' in the password The second digit of the code is the number of occurrences of the digit '1' in the password The third digit of the code is … Continue reading Clock

# Boys-Girls

Question: In a country where everyone wants a boy, each family continues having babies till they have a boy. After some time, what is the proportion of boys to girls in the country? (Assuming probability of having a boy or a girl is the same) Answer: This is a very simple probability question in a software interview. … Continue reading Boys-Girls

# Bytes

Question: You have a stream of bytes from which you can read one byte at a time. You only have enough space to store one byte. After processing those bytes, you have to return a random byte. Note: The probability of picking any one of those bytes should be equal. Answer: Since we can only store one … Continue reading Bytes

# Ants

Question: Three ants are sitting at the three corners of an equilateral triangle. Each ant starts randomly picks a direction and starts to move along the edge of the triangle. What is the probability that none of the ants collide? Answer: So let’s think this through. The ants can only avoid a collision if they all decide … Continue reading Ants

# Marble and Jars

Question: You have 50 red marbles, 50 blue marbles and 2 jars. One of the jars is chosen at random and then one marble will be chosen from that jar at random. How would you maximize the chance of drawing a red marble? What is the probability of doing so? All 100 marbles should be placed … Continue reading Marble and Jars