about | help | code help+videos | done | prefs |
apcsaListHalfBeforeZeros
Given an ArrayList of Integers, replace the element just before an element with a value of zero with an element that is one-half the original value (using integer division). Return the modified ArrayList. Precondition: elements with values of zero will have index values > 0.HINTWatch for bounds errors! apcsaListHalfBeforeZeros([2, 0, 5]) → [1, 0, 5] apcsaListHalfBeforeZeros([5, 0, 3, 2, 0]) → [2, 0, 3, 1, 0] apcsaListHalfBeforeZeros([2, 32, 33, 0]) → [2, 32, 16, 0] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 220
Copyright Nick Parlante 2017 - privacy