Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #11982

Re: Hardest Google Interview Question

From Willem <willem@toad.stack.nl>
Newsgroups comp.lang.c
Subject Re: Hardest Google Interview Question
Date 2011-10-23 09:40 +0000
Organization Stack Usenet News Service
Message-ID <slrnja7o80.74s.willem@toad.stack.nl> (permalink)
References <006ca4a6-1efa-4cb5-905b-91dee8c80afc@s35g2000pra.googlegroups.com> <0eaed2b5-62dc-4890-8488-eec083ca0470@fk25g2000vbb.googlegroups.com> <slrnja7lgb.9b.willem@toad.stack.nl> <54ca53b0-ab74-41c2-ab05-d1f605928082@a12g2000vbz.googlegroups.com>

Show all headers | View raw


Malcolm McLean wrote:
) On Oct 23, 10:53?am, Willem <wil...@toad.stack.nl> wrote:
)> Malcolm McLean wrote:
)>
)> ) On Oct 23, 8:39?am, divya bisht <bisht88.di...@gmail.com> 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
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Hardest Google Interview Question Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-10-23 00:02 -0700
  Re: Hardest Google Interview Question Willem <willem@toad.stack.nl> - 2011-10-23 08:53 +0000
    Re: Hardest Google Interview Question Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-10-23 02:21 -0700
      Re: Hardest Google Interview Question Willem <willem@toad.stack.nl> - 2011-10-23 09:40 +0000
        Re: Hardest Google Interview Question Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-23 11:48 -0400
    Re: Hardest Google Interview Question arnuld <sunrise@invalid.address> - 2011-10-25 05:26 +0000
  Re: Hardest Google Interview Question Mark Bluemel <mark_bluemel@pobox.com> - 2011-10-25 08:52 +0100
    Re: Hardest Google Interview Question falk@rahul.net (Edward A. Falk) - 2011-10-25 19:47 +0000
    Re: Hardest Google Interview Question Sjouke Burry <b@p.nl> - 2011-10-26 22:51 +0000

csiph-web