D
divya bisht
Hardest Google Interview Question
http://hardest-puzzle.blogspot.com/2011/10/google-interview-question.html
http://hardest-puzzle.blogspot.com/2011/10/google-interview-question.html
Drop from first floor. If it doesn't break, pick up the egg, and tryHardest Google Interview Question
http://hardest-puzzle.blogspot.com/2011/10/google-interview-question....
The obvious method is a binary search. However you are only allowed toMalcolm McLean wrote:
)> Hardest Google Interview Question
)>
)>http://hardest-puzzle.blogspot.com/2011/10/google-interview-question.....
)>
) Drop from first floor. If it doesn't break, pick up the egg, and try
) the second floor, and so on. When it breaks, you know the critical
) floor.
If this is the puzzle I think it is, you're supposed to have two eggs, and
the question is to determine the minimal number of drops which guarantees
an answer.
Malcolm McLean wrote:
)> Malcolm McLean wrote:
)>
)> )> Hardest Google Interview Question
)> )>
)> )>http://hardest-puzzle.blogspot.com/2011/10/google-interview-question....
)> )>
)> ) Drop from first floor. If it doesn't break, pick up the egg, and try
)> ) the second floor, and so on. When it breaks, you know the critical
)> ) floor.
)>
)> If this is the puzzle I think it is, you're supposed to have two eggs, and
)> the question is to determine the minimal number of drops which guarantees
)> an answer.
)>
) The obvious method is a binary search. However you are only allowed to
) break a maximum of two eggs, and you have 100 floors to search, so it
) won't work.
The obvious method with 2 eggs is to use the first egg in increments of 10
floors until it breaks, and then use the second on the 10-floor interval
below the floor where the first one broke. 19 drops worst case, IICC.
But you can do better than that.
SaSW, Willem
distributions (starting by dropping an egg from the first floor is
very likely to give the correct answer very, very quickly),
That's their hardest question? Seriously? Apart from the problem that
the "question" in the end is a bit unclear. The number of drops needed
obviously depends on something you don't know, which is the lowest
height that will break the egg.
A clearer question would be "which
strategy gives the lowest expected number of drops", given some
distribution of probabilities, or "which strategy produces the
smallest maximum number of drops".
If this is the puzzle I think it is, you're supposed to have two eggs,
and the question is to determine the minimal number of drops which
guarantees an answer.
I don't know if it's "depressing", but as usual I'm somewhatI would be surprised if they're still asking that one; Google tends
to ban questions that are too widely known.
These questions are asked to test to see if you can work out problems
and to get a look into your thought process. In my experience, the
interviewer will generally coax you along rather than force you to
flounder if you don't get it right away. Of course, if you *do*
get it right away, that's even better.
Question specifies that it could break anywhere from the first
to the last floor.
We generally asked the interviewee to optimize the worst-case
scenario for number of drops. If they got it easily enough,
we'd ask what the expected number of drops was. You'd be
depressed to know how few interviewees even understood that
part of the question.
I'm not sure I saw that in this thread, but it IS prettyAnother variant was to ask the interviewee to give the general
solution for N eggs and M stories.
I would be surprised if they're still asking that one; Google tends
to ban questions that are too widely known.
These questions are asked to test to see if you can work out problems
and to get a look into your thought process. In my experience, the
interviewer will generally coax you along rather than force you to
flounder if you don't get it right away. Of course, if you *do*
get it right away, that's even better.
Question specifies that it could break anywhere from the first
to the last floor.
We generally asked the interviewee to optimize the worst-case
scenario for number of drops.
If they got it easily enough,
we'd ask what the expected number of drops was.
You'd be
depressed to know how few interviewees even understood that
part of the question.
These questions are asked to test to see if you can work out problems
and to get a look into your thought process. In my experience, the
interviewer will generally coax you along rather than force you to
flounder if you don't get it right away. Of course, if you *do*
get it right away, that's even better.
Hardest Google Interview Question
http://hardest-puzzle.blogspot.com/2011/10/google-interview-question....
No, this is wrong.The answer is a minimum of 2 drops, maximum of 50 drops. If there
exists a floor that will crack an egg(there is the exceptional case
where a floor may not exist), then both eggs will need to be cracked
to find the floor. The average amount of drops is a summation of the
binary search method, switching to an incremental linear search
starting from the least floor in the most recent binary search area.
No, this is wrong.
By dropping the egg from floor 10, floor 20, and so, we can find the
block of ten floors on which it breaks. If it breaks, say, on floor 30
we know it didn't break on floor 20. So we try floor 21, floor 22, and
so on with the second egg. If the second egg doesn't crack on floor
29, we know the answer must be floor 30, and in this rare situation we
save an egg.
The first part of the problem is to get the general strategy. The next
part is to find the sequence of floors which give the result in the
fewest possible drops. If you assume that the prior probability is
evenly distributed between floors 1 to 100, there is a solution.
I never follow blogspot links, I understood them to be basically bait
for click farming.
I use similar questions. The purpose is to learn how they go about
_finding_ the answer; if they get it "right away", I learn nothing and
have to come up with a harder one. OTOH, I don't hold it against them
if they don't get the solution in the allotted time, even with liberal
hints. The only way to _fail_ the question is to give up. Incorrect
answers are fine as long as the reasoning behind them is sound.
I use similar questions. The purpose is to learn how they go about
_finding_ the answer; if they get it "right away", I learn nothing and
have to come up with a harder one. OTOH, I don't hold it against them
if they don't get the solution in the allotted time, even with liberal
hints. The only way to _fail_ the question is to give up. Incorrect
answers are fine as long as the reasoning behind them is sound.
I am spectacularly good at coming up with answers in which I solve the hard
part fast enough that it's not obvious that I didn't know it already, and
then get the easy part wrong.
When I was a kid, they attempted to give me an IQ test. They got to the
famous "5-quart and 3-quart jugs, get exactly 2 quarts" puzzle. I
walked through things like "here is how I can measure the heights of the
jars and subdivide them", stuff like that. They kept having to add
qualifiers.
I still have no clue whether they scored that as success or failure.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.