Domanda di colloquio di Duolingo

questions about time/space complexity for some code