JPMorganChase interview question

Both were array questions in python,