Mphasis interview question

Nothing much difficult