Pregunta de entrevista de Palantir Technologies

Time and space complexity of sample code