J.P. Morgan Interview Question

Data structures and algorithms ,oops