Pergunta de entrevista da empresa JPMorganChase

Gave 2 leetcode problems. One easy and one medium