Cognizant Interview Question

2 coding question and queries