JPMorganChase interview question

Hackerrank question with easy and medium Leetcode problems.