Back

swap the element with adjacent element?

Created 2 years ago
631 Views
4 Comments
SakthivelHmOLkh
@SakthivelHmOLkh
SakthivelHmOLkh
@SakthivelHmOLkhProfile is locked. Login

Given an array of N elements switch(swap) the element with the adjacent element and print the output.
Sample Testcase :
INPUT
5
3 2 1 2 3
OUTPUT
2 3 2 1 3

Comments (4)
Please login to comment.