Pregunta de entrevista de Duolingo

questions about time/space complexity for some code