J.P. Morgan interview question

It was some leet code questions with some array manipulations.