You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//n/2-> since we only have to reach till the middle of array to swap elements on both side of the middle element
for(int i=0; i<n/2;i++){
int temp =arr[i];
//swapping first position with last overwrites the last element on the first position, to avoid losing the first element we temporarily save it in s var.