Fidessa Interview Question

2 simple hackerrank question.. medium to easy difficulty