Skip to content

Instantly share code, notes, and snippets.

@kylelong
Last active June 9, 2019 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylelong/fbad5b9e579d1e1a4fe5bcb621d93819 to your computer and use it in GitHub Desktop.
Save kylelong/fbad5b9e579d1e1a4fe5bcb621d93819 to your computer and use it in GitHub Desktop.
6/2/19 Cassido's interview question of the week
#Given an array of integers, find the maximum range between two elements in the array.
def maxRange(arr)
return arr.max.abs - arr.min.abs
end
puts maxRange([2,2,1,3]) #2
puts maxRange([0]) #0
puts maxRange([4,3,5,7,1,7,7,6]) #6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment