Cognizant interview question

Simple logic and array based questions