J.P. Morgan interview question

Leet code medium questions over arrays.