Skip to content

Instantly share code, notes, and snippets.

@Opus1no2
Created June 3, 2016 21:02
Show Gist options
  • Save Opus1no2/1ede140bc281d3a9640e7c8ec8528a08 to your computer and use it in GitHub Desktop.
Save Opus1no2/1ede140bc281d3a9640e7c8ec8528a08 to your computer and use it in GitHub Desktop.
input = ARGF.read.split(/\n/)[1].split.map { |v| v.to_i }.sort
p input[-2, 2].inject { |sum, n| sum.to_i * n.to_i }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment