Domanda di colloquio di J.P. Morgan

Solve programming problem and describe approach