J.P. Morgan interview question

Data structures and algorithms ,oops