Pregunta de entrevista de J.P. Morgan

They asked 2 algorithm questions.