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

 

frew@mclean.com > filterRange
prev  |  next  |  chance

Write a method filterRange that accepts an ArrayList of integers and two integer values min and max as parameters and removes all elements whose values are in the range min through max (inclusive) from the list. For example, if a variable called list stores the values: [4, 7, 9, 2, 7, 7, 5, 3, 5, 1, 7, 8, 6, 7] The call of filterRange(list, 5, 7); should remove all values between 5 and 7, therefore it should change the list to store [4, 9, 2, 3, 1, 8]. If no elements in range min-max are found in the list, the list's contents are unchanged. If an empty list is passed, the list remains empty.


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

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

public List filterRange( int min, int max,ArrayList<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

Copyright Nick Parlante 2017 - privacy