about | help | code help+videos | done | prefs |
Given an ArrayList of Integers and an int num, find the element that is greater than the smallest num elements of the list. Re-position that element only, so that it now appears at index num instead of its original index. Return the modified ArrayList. Preconditions: 0 <= num < lst.size(), and the value of the desired element will not be repeated in lst. HINT You know how to find the minimum element of a collection. Can you do that more than once? How would you keep track of which elements were smaller than the desired element?apcsaListMoveGreaterThan([2, 1], 1) → [1, 2] apcsaListMoveGreaterThan([1, 2], 1) → [1, 2] apcsaListMoveGreaterThan([5, 4, 3, 2, 1], 1) → [5, 2, 4, 3, 1] ...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: 320
Copyright Nick Parlante 2017 - privacy