Very Simple Code|| C++


#1

vector Solution::wave(vector &A) {
sort(A.begin(),A.end());
int n=A.size();
int i=1;
while(i<n){
swap(A[i],A[i-1]);
i=i+2;
}
return A;
}