Fidessa interview question

2 simple hackerrank question.. medium to easy difficulty