HCLTech interview question

Difficulty level medium