Your task is to write solutions to stevey’s phone-screen exercises. When you are finished, you are welcome to read a suggested solution, or to post your solution or discuss the exercise in the comments below.

I couldn’t resist writing smartass responses for questions three and five to just return fixed strings. I also wrote more general answers that I thought were more in keeping with the spirit of the exercise.

The basic recursive implementation for Fibonacci numbers is a classic, but is terribly slow. It’s the answer I’d expect out of most interview candidates as a first pass since it is taught so regularly as an example of recursion. However, they’d be in trouble if they couldn’t quickly identify the problems with such an implementation. I wrote out a couple of alternatives that are a bit more efficient.