about | help | code help+videos | done | prefs |
Given an array of integers return an array with the 1st and last element swapped (i.e. the outermost elements swapped), the 2nd outermost elements swapped, and the 3rd outermost elements swapped, EXCEPT don't swap the middle two elements (for an array with an even number of elements) or middle three elements (for an array with an odd number of elements). swapOutermostThree([1, 2, 3, 4]) → [4, 2, 3, 1] swapOutermostThree([1, 2, 3, 4, 5]) → [5, 2, 3, 4, 1] swapOutermostThree([1, 2, 3, 4, 5, 6]) → [6, 5, 3, 4, 2, 1] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy