Pregunta de entrevista de J.P. Morgan

Basic coding questions, then your thought process on them