J.P. Morgan interview question

It was a hackathon code for good