Last active
July 1, 2016 03:55
-
-
Save jaryl/29ecae17d4c014c5701d99fb512efa4d to your computer and use it in GitHub Desktop.
Code Challenge Solution
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
DATA = { | |
[47, 2, 3, 8] => '84732', | |
[47, 40, 4] => '47440', | |
[42, 40, 4] => '44240', | |
[421, 42, 423] => '42423421', | |
[47, 2, 3, 8, 47, 40, 4, 42, 40, 4, 421, 42, 423] => '84747444242423421404032' | |
} | |
def large_hadron_concatenator(data) | |
data.sort { |a, b| "#{b}#{a}" <=> "#{a}#{b}" }.join | |
end | |
DATA.each do |key, value| | |
puts large_hadron_concatenator(key) == value | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment