J.P. Morgan Interview Question

Basic coding questions, then your thought process on them