File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programming Diversions and the fly likes strings and lighter[easy] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "strings and lighter[easy]" Watch "strings and lighter[easy]" New topic
Author

strings and lighter[easy]

Arjunkumar Shastry
Ranch Hand

Joined: Feb 28, 2005
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?


Namma Suvarna Karnataka
Sameer Jamal
Ranch Hand

Joined: Feb 16, 2001
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 ]
 
wood burning stoves
 
subject: strings and lighter[easy]
 
Similar Threads
Array of Strings
NX: Wrapping JOption messages
string delimiter
parsing interview question
What is the diff b/w string & String buffer?