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

 

bryce.hulett@hotmail.com > maxToBack
prev  |  next  |  chance

Write a method maxToBack that takes a List of integers as a parameter and that moves the max value in the list to the back, otherwise preserving the order of the elements. For example, if a variable called list stores the following values: {3, 8, 92, 4, 2, 17, 9} and you make this call: maxToBack(list); it should store the following values after the call: {3, 8, 4, 2, 17, 9, 92} You may assume that the list stores at least one value.


maxToBack([3, 2, 1]) → [2, 1, 3]
maxToBack([5]) → [5]
maxToBack([1, 2, 3, 4, 3, 2, 1]) → [1, 2, 3, 3, 2, 1, 4]

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

public List maxToBack(List<Integer> list){ }

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 Post-solution available

Copyright Nick Parlante 2017 - privacy