Microsoft Interview Question
Software Engineer / DevelopersThis solution seems convincing when the ropes burn with a uniform rate.
This ain't correct for the given scenario.
Consider a case where it take 30min to to burn 25% of the rope and another 30min for the rest 75% [given the rate could be non-uniform]. In that case, 30min would have passed when only half the rope is burnt if burnt from both ends.
The 1st soln is correct. When burnt frm either side the ropes should burn in 1 hr. So if a given rope is burnt frm both side it is bound 2 be completely burnt in half an hour. There is nothing 2 explain in that.
I was thinking of another soln which is almost same as d previous one.
Burn the 2 ropes 2gether keeping them side by side but frm opposite lengths. When the fire for both the ropes come 2gether that signifies half an hour have elapsed. Extinguish both the ropes. Now each of them is going 2 take another half an hour. So al2gether its 1 and a half hour. But 1st solution is best.
burn rope at both the end simultaneously. it ll burn in 30 mins. when the first rope completes Then burn the other rope at one end.it ll burn in 1 hour making a total of 1.5 hrs
- Anonymous April 05, 2008