Burning Rope Puzzle - Measure 45 Minutes

The Burning Rope Puzzle

You have 2 ropes. Each takes exactly 60 minutes to burn. They are made of different material so even though they take the same amount of time to burn, they burn at separate rates. 
In addition, each rope burns inconsistently. How do you measure out exactly 45 minutes?

Both ropes burn at different rate , So how to calculate 45 minutes?

Lets understand the problem statement graphically and it will be more clear, 

Puzzle Logic


Let's solve the puzzle step by step.

How to calculate 30 minutes
If  you are thinking that by folding the Rope from middle will give you midpoint of Rope and burning the rope from one end till midpoint will give you 30 minutes, then you are wrong.

It is wrong because Rope is not uniform it means 50% of rope is not sure present at exactly middle because Rope may take 10 minutes to burn till middle and in remaining 50 minutes it burn 50%.

Solution:

STEP 1:
Take Rope 1, burn it from both end and for Rope 2 burn it from one end.
For Rope 1, point where both flames will meet each other will be exactly 30 minutes as it take 60 minutes for Rope to burn completely. It take half time because we lit the rope from both end.





Now we got 30 minutes and need to calculate remaining 15 minutes.
Remember after 30 minutes, Rope 1 will be completly burnt and Rope 2 is 50% burn as shown below.

 
STEP 2: 
Now after Rope 2 is already 50% burnt and for remaining 50% if we burn Rope 2 from other end as well, then it will take half amount of time that is 15 minute for Rope 2 to burn completly.
 

When Rope 2 both end flames meet each other that will be exactly 15 minutes.



Complete Solution:
  1. Burn Rope 1 from both end and at same time burn Rope 2 from one end.
  2. When Rope 1 finishes burning, it will be exactly 30 minutes and light the other end of the  Rope 2 at that time.
  3. When Rope 2 burns out that will be 45 minutes.


You may also like to see


Implement Stack using Two Queue

Find Largest and Smallest number in Array

Count zeros in a row wise and column wise sorted matrix

Find middle element of a linked list

Union and Intersection of Two Sorted Arrays

Merge two sorted arrays in Java

How is ambiguous overloaded method call resolved in java

Enjoy !!!! 

If you find any issue in post or face any error while implementing, Please comment.

Post a Comment