

How strong is your egg? - dogma
http://www.mytechinterviews.com/how-strong-is-your-egg

======
RiderOfGiraffes
OK, so now you know it can be done in 19 tries, let's see if it can be done in
fewer. Let's go for 18.

That means I can first drop the egg from the 18th floor and if it breaks, try
1 through 17. If it doesn't break then I've used one attempt and I'm allowed
17 more.

Let's try the 35th floor. If it breaks then I can try 19 through 34, again a
maximum of 18 (2 already plus another 16). If it doesn't break then I've used
two attempts and I'm allowed 16 more.

Continuing like this I can get up to 171, and spotting that pattern shows that
171 is 18x(18+1)/1, or the sum of numbers 1 through 18.

OK, so I should be able to get 100 floors with a starting value of 14.
14x(14+1)/2 = 105, and a check check shows I can do that.

So I can do it in 14, which I'm pretty sure is less than your 19. Given that
you asked:

    
    
        What is the minimum number of tries
        needed to find that information?
    

I think you're wrong.

In fact, I think the author has been seduced by the "double up till you exceed
your target, then fill in the gap" strategy. He has then stopped at what he
thinks is a good solution without really investigating further. That is, in
this case inappropriate.

The better strategy is "divide and conquer."

So let's drop the egg from the 50th floor. Whether it breaks or not we can use
the other egg to cover the half we want, so using at most 1+50 tests.

But the two halves aren't equal, firstly because if it doesn't break we can
use it again in the top half, dropping it from 75, and secondly because we've
already used one drop.

This is, of course, all assuming that eggs are completely undamaged/unchanged
by all these drops, but I've treated this as the puzzle you intended, rather
than haring off on creative side-tracks. I'm assuming you want someone
uncreative.

Do I get the job?

------
RiderOfGiraffes
He has the classic "find a loop in a linked list" question here:

<http://www.mytechinterviews.com/loop-in-a-singly-linked-list>

He seems to think it's the end of the story when he trots out the usual
"tortoise and hare" algorithm, without mentioning that it's more efficient to
use a teleporting tortoise.

