Question d’entretien chez J.P. Morgan

How did you solve your coding problem and explain it?