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?

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:**Take 1 Rope, burn it from both end, point where both flame will meet will be exactly 30 minutes as it take 60 minutes for each Rope to burn completely.

**Now we got 30 minutes and need to calculate 15 minutes more.**

We will use the same approach to calculate 15 minutes as we calculate 30 minutes.

Remember we have 2 Ropes, So we will use Rope 1 to calculate 30 minutes and Rope 2 to calculate 15 minutes.

**Complete Solution:**- Burn Rope 1 from both end and at same time burn Rope 2 from one end.
- When Rope 1 finishes burning, it will be exactly 30 minutes and light the other end of the Rope 2 at that time.
- 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