What is the best technical question you have been asked in an interview.
For me it was:
There is a robot on an infinite staircase - we have a single function step() that will cause the robot to take a single step up or down at random and return true or false accordingly.
Write a function stepUp() that will return only once the robot has taken a single step up.
Follow up questions:
1. Is your implementation guaranteed to work? What possible problems do you see with this approach?
2. Implement stepUp() without any local variables.
For me it was:
There is a robot on an infinite staircase - we have a single function step() that will cause the robot to take a single step up or down at random and return true or false accordingly.
Write a function stepUp() that will return only once the robot has taken a single step up.
Follow up questions:
1. Is your implementation guaranteed to work? What possible problems do you see with this approach?
2. Implement stepUp() without any local variables.
Comment