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

 

amjadm@miamioh.edu > insert
prev  |  next  |  chance

Given an array of ints, int index, and int newValue, insert the newValue at the given index and return a new array. You can always assume the given index is a valid index in the range.


insert([], 0, 111) → [111]
insert([1, 1, 1], 1, 0) → [1, 0, 1, 1]
insert([-1, 2, -4, 8], 4, 50) → [-1, 2, -4, 8, 50]

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

public int[] insert(int[] arr, int index, int newVal) { }

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: 210

Copyright Nick Parlante 2017 - privacy