Skip to content

Instantly share code, notes, and snippets.

@kkdai
Created February 4, 2014 19:20
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 kkdai/8810416 to your computer and use it in GitHub Desktop.
Save kkdai/8810416 to your computer and use it in GitHub Desktop.
def logstn(strs, number)
while (number >0)
logest = strs.inject do |first, second|
(first.length > second.length)? first : second
end
puts logest
strs.delete_if {|x| x==logest}
number -= 1
end
end
logstn(string_longest, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment