Wipro Interview Question

Solving a Array problem and get the result