Given a one-dimensional array, swap adjacent elements pairwise (e.g., index 0 with 1, 2 with 3, etc.). If the array length is odd, the last element remains unchanged.
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.