BNY Interview Question

(OA) Two medium/hard problems on hackerrank