about | help | code help+videos | done | prefs |
Write a method that swaps pairs of numbers in an array. Note that the array can be any length, including length zero, even lengths, and odd lengths. Look at the test data for examples. todays_2021_11_09_APSLHL_swapAdjacent([]) → [] todays_2021_11_09_APSLHL_swapAdjacent([1, 2, 3, 4, 5, 6, 7, 8]) → [2, 1, 4, 3, 6, 5, 8, 7] todays_2021_11_09_APSLHL_swapAdjacent([1, 2, 3, 4, 5]) → [2, 1, 4, 3, 5] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 220
Copyright Nick Parlante 2017 - privacy