Altimetrik interview question

Hacker rank test first need to clear