Cognizant Interview Question

Solving a code challenge .