Solving Imaginary Problems
The interview question:
def f(n) # define f so that f(f(n)) == -n end
Approach to solving:
- Define problem…
- … with tests
- Write the code we wish we had
- Implement that code, quick and dirty
- Tests passing? Refactor!
See the finished result on GitHub and the commit log that got us there.