JPMorganChase interview question

I got 2 coding questions