Filter Outside Range
ARRAY
Problem
Given two numbers lowerBound
and upperBound
, and an array array
, return a new array containing elements from array
that are less than lowerBound
and greater than upperBound
.
Examples
filterOutsideRange(5, 10, [1, 6, 11]) // [1, 11] /* Elements less than 5 and greater than 10 are 1 and 11. */ filterOutsideRange(3, 7, [0, 4, 9, 12]) // [0, 9, 12] /* Elements less than 3 and greater than 7 are 0, 9, and 12. */ filterOutsideRange(-5, 2, [-8, -3, 0, 1, 7]) // [-8, 7] /* Elements less than -5 and greater than 2 are -8 and 7. */
Loading...