id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

norm.krumpe@muohio.edu program11 > move
prev  |  next  |  chance

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)

int[] move(int[] nums, int startingLocation, int finalLocation) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy