JPMorganChase Interview Question

Gave 2 leetcode problems. One easy and one medium