J.P. Morgan Interview Question

coding using data structures