about | help | code help+videos | done | prefs |
Given an array, the index of an element in that array, and a destination location for that element (less than or equal to the original index), move that element into its destination, and shift all other elements downward, returning the modified array. Do not create a new array. Simply modify the existing array by moving the necessary elements. move([4, 7, 2, 8, 5], 3, 0) → [8, 4, 7, 2, 5] move([5, 10, 15, 20, 25, 30, 35, 40], 5, 2) → [5, 10, 30, 15, 20, 25, 35, 40] move([5, 10, 15, 20, 25, 30, 35, 40], 5, 5) → [5, 10, 15, 20, 25, 30, 35, 40] ...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: 200
Copyright Nick Parlante 2017 - privacy