J.P. Morgan Interview Question

Some coding challenges using loops and arrays.