Infogain interview question

Coding question in technical interview