Cognizant interview question

about the coding section