Posts

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

Brain Teasers & Word Problems

1.  Suppose you have ten bags of marbles with ten marbles in each bag. If one bag weighs differentlyn the other bags, and you could only perform a single weighing, how would you figure out which one is different? 2.  You are about to hop on a plane to Seattle and want to know if you should carry an umbrella. You call three friends of yours that live in Seattle and ask each, independently, if it’s raining. 3.  Each of your friends will tell you the truth ⅔ of the time and mess with you by lying ⅓ of the time. If all three friends answer “Yes, it’s raining,” what is the probability that is it actually raining in Seattle? 4.  Imagine you are working with a hospital. Patients arrive at the hospital in a Poisson     Distribution, and the doctors attend to the patients in a Uniform Distribution. Write a function or code block that outputs the patient’s average wait time and a total number of patients that are attended to by doctors on a random day. 5....

Important puzzles for Interview (Remaining will be added soon)

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 | (Find ages of daughters) Alok has three daughters. His friend Shyam wants to...