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

 

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

Given an ArrayList of Integers, replace the third element with the val parameter. Return the modified ArrayList.


Precondition: lst will have at least 3 elements.

HINT:  Remember that indexes start at 0...

apcsaListReplaceThird([5, 1, 2], 5) → [5, 1, 5]
apcsaListReplaceThird([5, 1, 5], 5) → [5, 1, 5]
apcsaListReplaceThird([0, 1, 2, 3], -1) → [0, 1, -1, 3]

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

public ArrayList<Integer> apcsaListReplaceThird(ArrayList<Integer> lst, int val) { }

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