J.P. Morgan Interview Question

They asked two coding questions.