Pregunta de entrevista de Amazon

Time Complexity and space complexity.