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

 

konstans@stuy.edu set1 > increasingDistanceFromZero
prev  |  next  |  chance

The ArrayList<Integer> provided should only contain values that are increasingly far away from zero. Assume the first number is always valid, and that the ArrayList has at least one value. Beyond that, if a number is not farther away from zero than the previous number, it should be removed before checking the next number. Return the list after removing values.


increasingDistanceFromZero([1, 2, 3, 4, 5, 6]) → [1, 2, 3, 4, 5, 6]
increasingDistanceFromZero([1, 2, -3, 4, -5, 6]) → [1, 2, -3, 4, -5, 6]
increasingDistanceFromZero([1, 3, -3, 10, -5, 6, -7, 8, 9, 10]) → [1, 3, 10]

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

public ArrayList<Integer> increasingDistanceFromZero(ArrayList<Integer> n){ }

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

Copyright Nick Parlante 2017 - privacy