NTT DATA interview question

scenerio based code test series reverse code