Interview
Maths Puzzle
Numerical Ability
There is a building of 100 floors If an egg drops from the Nth floor or above it will break If it’s dropped from any floor below, it will not break You’re given 2 eggs Find N, while minimizing the number of drops for the worst case.
Read Solution (Total 3)
-
- First go to Floor 14, then 27, then 39, … This takes max 14 steps to find Nth floor.
If egg breaks at 14 th floor in first trial, then start from 1st floor and go up till egg is broken to find exact floor.
If 1st egg does not break at 14 th floor in first trial, drop 1st egg again from 27 th floor in 2nd drop. if it breaks, then start from 15th floor and go up till egg is broken to find exact floor.
..
..
so on
so max 14 chances are required.
- 10 years agoHelpfull: Yes(4) No(0)
- Egg 1 - Drop from floor 10, if it does not break proceed to floor 20. If it does not break, proceed to floor 30, etc.
Once Egg 1 breaks, go to 9 floors below where it broke. ie if it broke at 40, go to 31 and drop. Proceed up 1 floor at a time. N =< 10 - 10 years agoHelpfull: Yes(2) No(3)
- We will drop 1 egg from 50th floor
If it breaks then the Nth floor is below 50th floor else it is above 50th floor
Suppose it breaks then we will start testing from the first floor...testing includes ..dropping egg from the first floor if it breaks then N=1
Else if it doesn't break then we will drop it from second floor and so on .. The floor from which if the egg breaks will be N
If at the 50th floor the egg doesn't break then we will test from 75th(i.e. 50/2) floor... If it breaks then we will start testing from 51th floor and if it doesn't then
We will test from 88th(i.e. approx. 75/2) floor and keep on doing till we find the Nth floor
Here BINARY SEARCH approach is used so its complexity is log(100)=6.64~7
That means u will need to do maximum of 7 tries and will get the value of N - 10 years agoHelpfull: Yes(2) No(1)
Interview Other Question
Two MIT math grads bump into each other while shopping. They haven't seen each other in over 20 years. First grad to the second: "How have you been?"
Second: "Great! I got married and I have three daughters now."
First: "Really? How old are they?"
Second: "Well, the product of their ages is 72, and the sum of their ages is the same as the number on that building over there..."
First: "Right, ok... Oh wait... Hmm, I still don't know."
Second: "Oh sorry, the oldest one just started to play the piano."
First: "Wonderful! My oldest is the same age!"
How old was the first grad’s daughter?
I have a box of one hour fuses. If I set one end of a fuse on fire, I know that the fuse will burn all the way to the other end in EXACTLY one hour. However, the fuses may burn unevenly [ie - it may take 59 minutes to burn the first half of a fuse, but only 1 minute to burn the other half]. Furthermore, all of the fuses may burn unevenly at a different rate. The only thing we know for sure is that each one takes 1 HOUR to burn completely. The Question: Given 2 of these fuses and a lighter, how can I time out 45 minutes precisely?