Home » Other » Community Hangout » Some riddley interview questions.. how would you answer these?
Some riddley interview questions.. how would you answer these? Wed, 19 January 2011 15:20
 pyscho Messages: 134Registered: December 2009 Senior Member
Hi guys, just wanted input on how you would go about answering riddle/analytical questions. I have these in particular:

How many runs up a ladder an egg can be dropped from, before it will break on the surface (using the least number of attempts)

How to determine the same thing using the least number of eggs?

Given a string of open/close brackets of all 3 types: (, {, [, ), }, ], how to determine that the open/close brackets are in the correct mathematical sequence, e.g ({[]{}()})
Re: Some riddley interview questions.. how would you answer these? [message #489903 is a reply to message #489896] Wed, 19 January 2011 20:41
 BlackSwan Messages: 25478Registered: January 2009 Location: SoCal Senior Member
>How to determine the same thing using the least number of eggs?
Binary search.
Go up half way & drop an egg.
depending upon results either go up a quarter or go down a quarter.
Lather, Rinse, repeat.
Re: Some riddley interview questions.. how would you answer these? [message #489941 is a reply to message #489903] Thu, 20 January 2011 02:34
 ThomasG Messages: 3201Registered: April 2005 Location: Heilbronn, Germany Senior Member
On the bracket problem:

Us a stack. Every time a bracket opens push the bracket type (1,2,3) onto the stack. Every time a bracket closes it's type must match the type of the last one on the stack, which can then be removed. The last bracket in the string must be a closing bracket that removes the last bracket type from the stack.

 Previous Topic: Hello, Good Day, Happy New Year, etc, etc...! Next Topic: They do not hire leaders any more !!!
Goto Forum:

Current Time: Thu Jun 29 06:01:25 CDT 2017

Total time taken to generate the page: 0.16873 seconds