Expected Time Complexity : O(N) , where 'N' is the size of the array .
1<=A[i]<=1000000
1<=N<=100000
Example :
2 2 4 5
Output : 5 [ {2,2,2,2} will be the final array with all equal elements]
Note :
1)Algorithm-explanation is must .
2)Adding code is optional .
3)Use Format option while adding code