Created
December 9, 2015 18:36
-
-
Save edenthecat/0186106768f08c1cd8cc to your computer and use it in GitHub Desktop.
Ruby: Find the Fifth Largest Integer in an Array of Unsorted Integers
This file contains hidden or 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 findFifthLargest | |
someIntegers = [1, 7, 4, 506, 3, 9, 10, 33] | |
sortedIntegers = someIntegers.sort.reverse! | |
puts sortedIntegers[4] | |
end | |
findFifthLargest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment