Last active
June 9, 2019 05:01
-
-
Save kylelong/fbad5b9e579d1e1a4fe5bcb621d93819 to your computer and use it in GitHub Desktop.
6/2/19 Cassido's interview question of the week
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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