Goldman Sachs Interview Question
Developer Program EngineersCountry: India
Interview Type: In-Person
Hi,
I am not sure if I am getting this wrong.
But, the objectivity to measure 1 hour 30 mins and 45 minutes seems absurd, while you have limited resources that last for 2 hours only (2 sticks, one hour each).
So if you have one stick extinguished, you will only have another stick which no matter what, will burn for not more than 1 hour.
For a. 1/2 hour: Burn both sides of a stick (say Stick1), so it would be done burning in 30 min
Now, if you needed to have 1 and 1/2 hours, then simply start burning the next stick (say Stick2), after the first stick (Stick1) is done/burnt.
However, if you needed 45 mins, then start burning second stick (say Stick2) only from one side, at the same time as the first stick (say Stick1) was being started to burn from both side.
- So as soon as the first stick (say Stick1) is burnt from both side ie. 30 mins, the second stick (say Stick2) would have burnt from one side ie. half burnt already, simply start fire on the other/remaining side of second stick (say Stick2), so it would take another 15 mins to burn while being burnt from both sides. in all 1st stick takes 30 mins, and then second stick another 15 mins so we get 45 mins :)
- sjain March 05, 2013