about | help | code help+videos | done | prefs |
Given an ArrayList of Integers and an int base, find out if any element of the list has a value with more digits than the element before it, but when expressed in the desired base. If so, take off the extra rightmost digits (from the version of the number in that base) and add them as their own integer element at the end of the ArrayList. Keep processing the list from beginning to end until you cannot make any more changes - this will in many cases require more than one pass! By the time your processing is done, all items in the ArrayList will have nonincreasing lengths, when expressed in the target base. Return the modified ArrayList. Precondition: base > 1. See the previous problem for more ideas.apcsaListMoveExtraBaseDigits([1, 2], 2) → [1, 1, 0] apcsaListMoveExtraBaseDigits([3, 9, 4], 2) → [3, 2, 2, 1, 0] apcsaListMoveExtraBaseDigits([3, 9, 4], 3) → [3, 3, 4, 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: 330
Copyright Nick Parlante 2017 - privacy