Microsoft interview question

Explain Recursion to a 5 year old.

Interview Answer

Anonymous

Nov 6, 2014

Struggled with this one and ended up not being able to explain it well. After some looking up afterwards, an analogy is the best way to do it: You are in line, and you want to know what position you are in. To find out, you ask the person in front of you. They don't know either, and ask the person in front of them. This continues until the first person in line is asked. They respond back 1, and then each person just adds one to the answer they receive, until it reaches you.

14