JPMorganChase interview question

Basic coding (not a leet code type)