J.P. Morgan interview question

Coding questions, strings and arrays