J.P. Morgan interview question

Array; Algorithm; Functions.