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

 

zbaharav@kehillah.org 66-sortingprep > insertMiddle
prev  |  next  |  chance

Given an int array with even number of elements, return a new array that is formed by inserting the number 999 to the middle of the original array. For example, {0, 1, 2, 3} -> {0, 1, 999, 2, 3}


insertMiddle([0, 1, 2, 3, 4, 5, 6, 7]) → [0, 1, 2, 3, 999, 4, 5, 6, 7]
insertMiddle([100, 34]) → [100, 999, 34]
insertMiddle([-2, 4, 8, 32, 16, 1]) → [-2, 4, 8, 999, 32, 16, 1]

...Save, Compile, Run (ctrl-enter)

public int[] insertMiddle(int[] a){ }

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

Copyright Nick Parlante 2017 - privacy