Skip to content

Instantly share code, notes, and snippets.

@doxavore
Created January 26, 2011 05:38
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 doxavore/796283 to your computer and use it in GitHub Desktop.
Save doxavore/796283 to your computer and use it in GitHub Desktop.
first = ["t", "o", "p", "c", "o", "d", "e", "r", "s", "i", "n", "g", "l", "e", "r",
"o", "u", "n", "d", "m", "a", "t", "c", "h", "f", "o", "u", "r", "n", "i"]
second = ["n", "e", "f", "o", "u", "r", "j", "a", "n", "u", "a", "r", "y", "t", "w",
"e", "n", "t", "y", "t", "w", "o", "s", "a", "t", "u", "r", "d", "a", "y"]
hash = Hash.new(0)
(first + second).each_with_index do |element, i|
hash[element] += 1
end
hash.values.max
# => 6
@MarkBorcherding
Copy link

Isn't it crazy how many more lines that takes in C#?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment