Google interview question

Some basic loop/recursion