J.P. Morgan Interview Question

It was a hackathon code for good