Amazon Robotics interview question

some basic problem about recursion