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

 

siochi@cnu.edu > insertAt
prev  |  next  |  chance

Write a method that inserts an int into an array of ints at the given position. The resulting array should be returned in a new array. The given positions (p) will always be between 1 and the length of the array + 1, inclusive.


insertAt([1, 2, 3], 4, 1) → [4, 1, 2, 3]
insertAt([1, 2, 3], 4, 2) → [1, 4, 2, 3]
insertAt([1, 2, 3], 4, 3) → [1, 2, 4, 3]

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

public int[] insertAt(int[] ra, int n, int p) { }

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

Copyright Nick Parlante 2017 - privacy