J.P. Morgan interview question

Data structures puzzles.