Integers in Range of X,Y

You are given an array of integers and an array containing a range of integers (in the form of \[X, Y]) as arguments. Return an array containing all of the elements from the array of integers that are contained in the range.

X will always be a smaller number than Y.

There will always be at least one integer from the array found the X,Y range.


  • Must return an array of integers
  • Must work with both positive and negative integers

Example #1

solve([1,2,3,5,6,7], [2,6])
> [3, 5]

Example #2

solve([1,2,3,4,5,10,20], [4,7])
> [5]