This week's book giveaway is in the Performance forum.We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!

# strings and lighter[easy]

Arjunkumar Shastry
Ranch Hand
Posts: 986
You are given two strings of length X each and one lighter.Burning of each string completely takes 60 minutes.Burning time is not necessarily proportional to length,means its not necessary that in 30 minutes exactly half of the string will get burned.
Now you want to count 45 minutes.How will you do it?

Sameer Jamal
Ranch Hand
Posts: 1870
Put the two strings apart from each other. Light both ends of first string and one end of second string. When the first string is completely burned out, exactly 30 min have been passed, which means that the second string has exactly 30 min left to burn. Light the other end of the second string. It will now burn out twice as fast in exactly 15 min. The total burning time is 45 min.

Am I missing something.
[ October 17, 2005: Message edited by: Sameer Jamal ]