Pregunta de entrevista de Bloomberg

LC problem, and some c++ basic problem