[PART : 1] Cracking the Coding Interview Puzzles
Puzzle 1 | (How to Measure 45 minutes using two identical wires?) How do we measure forty-five minutes using two identical wires, each of which takes an hour to burn. We have matchsticks with us. The wires burn non-uniformly. So, for example, the two halves of a wire might burn in 10 minute and 50 minutes respectively Solution : The wires are burning at non-uniform speed, but the time it takes to burn is uniform. The first wire when it is burning from both ends, it will take exactly 30mins to burn completely, but this point of both ends joining will not be the mid point. Meanwhile, the one end which is burning in the second wire would have burnt for 30mins and then when lit from the other end, it will take exactly 15mins to burn completely. So it total, you can measure 30 mins from 1st wire and 15mins from second wire and a total of 45 mins Puzzle 2 | (The Heavy Pill: You have 20 bottles of pills. 19 bottles have 1.0 gram pills, but on...