Skip to content

Instantly share code, notes, and snippets.

@jaryl
Last active July 1, 2016 03:55
Show Gist options
  • Save jaryl/29ecae17d4c014c5701d99fb512efa4d to your computer and use it in GitHub Desktop.
Save jaryl/29ecae17d4c014c5701d99fb512efa4d to your computer and use it in GitHub Desktop.
Code Challenge Solution
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