Cognizant Interview Question

Based upon some basic algorithms