Pregunta de entrevista de Jane Street

Programming questions. I answered in python.