Skip to content

Instantly share code, notes, and snippets.

View ciniglio's full-sized avatar

Alejandro Ciniglio ciniglio

View GitHub Profile
@ciniglio
ciniglio / challenge.rb
Created May 2, 2012 04:58 — forked from isa/gist:2571012
Convert in less than 30 lines
LIST = [['A','B','C'], ['A','C','E'], ['E','F','D'],['D','A','J'],['E','D','J']]
out = Hash.new(0)
LIST.each do |row|
arr = row.sort + row.sort
3.times { out[[arr.shift,arr.shift].sort] += 1 }
end
for key in out.keys.sort do
puts "#{key.join(", ")}, #{out[key]}"
end