Freshworks interview question

Hackerrank questions from collection and looping