Cognizant Interview Question

Puzzles and coding