There are two sand timers which show 4 minutes and 7 minutes respectively. What would be the best approach to get a time of 9 minutes using both the sand timers, at one time or one after another or in any other combination?


Updated: Nov. 27, 2020 — Training Time: 2 minutes
Overseen by: Archangel Macsika

Topic: Data Science.

Difficulty: Intermediate.

Companies who previously asked this: -

Objective: Four people A, B, C, D need to cross a bridge at night, and they have only one torch. The bridge is too dangerous to cross without a torch and is strong enough to support a maximum of two people at a time. They take 1, 2, 5 and 8 minutes respectively. What is the shortest time needed for all four of them to cross the bridge?

Short Answer: practical answer.

Full Solution

At first, both sand timers will be used simultaneously.
Current state: 0 minutes completed.

When the time is 4 minutes, the 4-minute sand timer would have been exhausted while the 7-minute sand timer remains 3 minutes.
Current state: 4 minutes completed.

At the completion of 4 minutes, restart the 4-minute sand timer by turning upside down and continue the process with the remaining 3 minutes of the 7-minute sand-timer.

When the time is 7 minutes, the 4-minute sand timer will have 1 minute remaining while the 7-minute sand timer will be exhausted.
Current state: 7 minutes completed.

At the completion of 7 minutes, restart the 7-minute sand timer by turning upside down and continue the process with the remaining 1 minute of the 4-minute sand-timer.

When the time is 8 minutes, the 4-minute sand timer will exhaust the remaining 1 minute while the 7-minute sand timer will have 6 minutes on one side and 1 minute at the other side.
Current state: 8 minutes completed.

At this point, turn the side of the 7-minute sand timer having 1 minute remaining, the total timing would be 9 minutes.
Current state: 9 minutes completed.

Was this training resource helpful?