JPMorganChase Interview Question

Basic coding (not a leet code type)