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

 

orion.a.smith@gmail.com apcsa-lists > apcsaListReplaceSomewhere
prev  |  next  |  chance

Given an ArrayList of Integers, the value of the first element is the index to replace, and the value of the second element is the new value for the replaced element. Return the modified ArrayList.


Precondition: lst will have enough elements.  The first element will have a value greater than or equal to 0.

apcsaListReplaceSomewhere([2, 3, 2]) → [2, 3, 3]
apcsaListReplaceSomewhere([1, 1, 5]) → [1, 1, 5]
apcsaListReplaceSomewhere([0, 1, 2, 3]) → [1, 1, 2, 3]

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

public ArrayList<Integer> apcsaListReplaceSomewhere(ArrayList<Integer> lst) { }

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