J.P. Morgan Interview Question

They mainly asked to solve programs