Mphasis interview question

it was simple only for me