-
-
Save deathwishdave/a80dbada482a3533995d46829174aa6a 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
A | A |
---|
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
require 'csv' | |
data = CSV.parse(File.read('rooms.csv')) | |
groups = Hash.new(0) | |
data.flatten! | |
data.each_index do |i| | |
data.each_index do |j| | |
if data[i] = data[j] | |
if groups.has_key?(data[i]) | |
groups[data[i]] += 1 | |
else | |
groups[data[i]] = 1 | |
end | |
end | |
end | |
end | |
puts groups. inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment