Pregunta de entrevista de Palantir Technologies

leetcode style question, data structure related