J.P. Morgan interview question

Java based question and data structure