Agtiv Consulting interview question

Hacker Rank easy, easy, medium