Mphasis interview question

Basic question and coding round