Cognizant interview question

They asked me to write a code to reverse an array and print