## Sunday, June 23, 2013

### Interview Puzzles - Solved

It's a practice that the interviewers in order to check one's analytical ability ask puzzles so that they understand the thought process of the candidates. There are hoardes of those available on net but for my readers I am herewith providing solutions for 2 of the most commonly asked puzzles. You may also post your puzzles in the comments section for the benefit of everyone.

1) 12 identical marbles with 1 defective piece and you are given a weighing machine. You have to come with the minimum possible weighings to identify the defective piece.

2) You are standing in front of a 100 floor building and given 2 eggs . You are asked to find out the strength of the egg by telling the number of floor from where if its dropped is not broken. The egg may break at any floor. [ If the egg breaks at 22nd floor then it breaks if dropped from any floor above 22 so you have to find out exactly from which floor it starts breaking]

Solution 1)

Solution 2)

First of all dont get carried away that the egg will break at 1st floor itself. Guys we have alien eggs here with us. You are given 2 eggs, cos if one egg is broken atleast the other is there to check the floor#.
I'd suggest to give with a hit & trial attempt to arrive at answer.
Lets say we choose the 50th floor to check the strength of the egg.
Now if the egg breaks at that floor then you are sure of one thing that the answer is less than 50 so you dont have to check the floors above it but, to arrive at the exact answer you will have to test from 1st floor to 49th floor till it breaks.
If it doesnt break at 50th floor then that means the answer is higher than 50. You have to again go into iterations.

If we chose to check at 25th floor in 1st attempt and it breaks then you have to check a maximum of 24 floors more to assess and if the egg doesnt breaks then you may chose 50 and so on..
Now this is the logic you have to arrive at to crack the puzzle.
I will put in the form of a function

So if you choose a frequency of X, the maximum number of attempts you have to make is (X-1+100/X); SO f(x) = (x-1+100/x)

We are interested in minimising the attempts so basically we have to find the x for which f(x) takes minimum value.
Going by our good old calculus, f'(x) = 0 to check the local minima and maxima.
f'(x) = 1-100/x2 (x2=x*x)
When you equate that to 0, we get x value as 10. To check if that is max or min, we have to do the double derivative test.
If f"(x)>0 then it is minima viceversa.
f"(x) = 200/x3 (x3=x*x*x)
f"(10)=0.2 which is greater than 0 hence the value 10 is a minima.
Therefore the frequency of 10 gives us the minimum number of attempts to check the strength of the egg. The attempts = f(10)=10-1+100/10=19.
The answer is 19.

1. I felt really dumb after reading this post.
Do they REALLY give you stuff like that?! I'd fail any interview then! omGod! lol..
there goes my future haha.

2. Hey Buddy,
The above 2 are most commonly asked ones..
Most of the IT companies & consulting companies ask puzzles to understand the analytical abilities of candidates.. actually by solving them regularly your mind gets tuned to it..the 1st time you will feel it difficult..its all about how you approach.

3. ohhh.. :(

I dunno. I should do more brain teasers I suppose.

Thanks for dropping by my blog. I really stopped posting AGES AGO. I'm just too lazy/busy!
Will post soon if God may! hahaXD

4. Hey buddy,
thats the fact, as we grow up..our mind stops working :P

5. If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you have to watch this video
right away...

(VIDEO) Get your ex back with TEXT messages?

I welcome brickbats as well..so hit me hard with your comments..