Job Interview Brain Teasers
by Curtis Krauskopf
Riddles seem to be popular amongst some interviewers. The purpose of the
riddle is not necessarily to get the right answer -- rather, it's to see how
the candidate reacts when faced with a non-standard programming question.
Demonstrate your flexibility on-the-job by being able to answer these questions.
The Three Jugs Problem
Two friends who have an eight-quart jug of water wish to share it evenly. They also have two empty jars, one holding five quarts, the other three. How can they each measure exactly 4 quarts of water?
Geometry in real-life
Why is a manhole cover round?
We'll cross that bridge when we get to it
There are 4 women who want to cross a bridge. They all begin on the same side. You have 17 minutes to get all of them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown, etc. Each woman walks at a different speed. A pair must walk together at the rate of the slower woman's pace.
- Woman 1: 1 minute to cross
- Woman 2: 2 minutes to cross
- Woman 3: 5 minutes to cross
- Woman 4: 10 minutes to cross
For example if Woman 1 and Woman 4 walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If Woman 4 then returns with the flashlight, a total of 20 minutes have passed and you have failed the mission. What is the order required to get all women across in 17 minutes? Now, what's the other way?