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

 

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

Given an ArrayList of Integers of unknown size and three other int values, remove the three elements of the ArrayList located at the index positions specified by the int values. Set the first element of the ArrayList to be the average of the three removed values (rounded to the nearest int), and return the ArrayList.


Preconditions: the ArrayList will have at least four elements, and the other int values will be in decreasing order to prevent confusion about which indexes they represent.

apcsaListAverageRemovals([3, 6, 8, 10], 3, 2, 1) → [8]
apcsaListAverageRemovals([-177, 383, 476, -15, 62, 19, -247], 3, 2, 1) → [281, 62, 19, -247]
apcsaListAverageRemovals([258, 99, 225, 430, -497, 124], 4, 3, 3) → [19, 99, 225]

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

public ArrayList<Integer> apcsaListAverageRemovals(ArrayList<Integer> lst, int a, int b, int c) { }

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

Copyright Nick Parlante 2017 - privacy