Kaar Technologies interview question

Coding problem Easy problem: Better think you will get it