Home » Other » Community Hangout » Some riddley interview questions.. how would you answer these?
Some riddley interview questions.. how would you answer these? [message #489896] Wed, 19 January 2011 15:20 Go to next message
pyscho
Messages: 134
Registered: 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 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: 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 Go to previous message
ThomasG
Messages: 3211
Registered: 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 Mar 28 05:29:03 CDT 2024