Skip to content

Instantly share code, notes, and snippets.

@jkaihsu
Created March 7, 2013 08:15
Show Gist options
  • Save jkaihsu/5106394 to your computer and use it in GitHub Desktop.
Save jkaihsu/5106394 to your computer and use it in GitHub Desktop.
Write a method count_between which takes three arguments as input: An Array of integers An integer lower bound An integer upper bound count_between should return the number of integers in the Array between the two bounds, including the bounds It should return 0 if the Array is empty.
def count_between(array, lower_bound, upper_bound)
array.count{|x| x >= lower_bound && x <= upper_bound}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment