Last active
December 9, 2015 20:03
-
-
Save edenthecat/f14d384ecdc49178783b to your computer and use it in GitHub Desktop.
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
def findHighestProduct(list_of_ints) | |
for i in 0...list_of_ints.length | |
list_of_ints[i] = list_of_ints[i].abs | |
end | |
puts list_of_ints.to_s | |
list_of_ints.sort!.reverse! | |
max_product = list_of_ints[0] * list_of_ints[1] * list_of_ints[2] | |
puts max_product | |
end | |
findHighestProduct([1, 8, 3, 5, 9, 12, -100]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment