Skip to content

Instantly share code, notes, and snippets.

@edenthecat
Created December 9, 2015 18:36
Show Gist options
  • Save edenthecat/0186106768f08c1cd8cc to your computer and use it in GitHub Desktop.
Save edenthecat/0186106768f08c1cd8cc to your computer and use it in GitHub Desktop.
Ruby: Find the Fifth Largest Integer in an Array of Unsorted Integers
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