J.P. Morgan interview question

Leetcode questions, with easy to medium difficulty