Posts

Showing posts from May, 2017

[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...

Data Science Puzzles-Brain Storming/ Puzzle

Puzzle 1)  How many Piano Tuners are there in Chicago?  Solution : To solve this kind of a problem, we need to know – How many Pianos are there in Chicago? How often would a Piano require tuning? How much time does it take for each tuning? We need to build these estimates to solve this kind of a problem. Suppose, let’s assume Chicago has close to 10 million people and on an average there are 2 people in a house. For every 20 households there is 1 Piano. Now the question how many pianos are there can be answered. 1 in 20 households has a piano, so approximately 250,000 pianos are there in Chicago. Now the next question is-“How often would a Piano require tuning? There is no exact answer to this question. It could be once a year or twice a year. You need to approach this question as the interviewer is trying to test your knowledge on whether you take this into consideration or not. Let’s suppose each piano requires tuning once a year so on the whole 250,000 piano...