Solution to the Coconut Delivery interview problem.