Cognizant interview question

Based upon some basic algorithms