Domanda di colloquio di Morgan Stanley

How would you write a recursive function and describe a real life example when it is needed.