Domanda di colloquio di CodePath

How did you come up with the solution?