Cognizant interview question

Coding while questioning.