Cognizant interview question

Write program to replace elements of an array