Skip to content

Instantly share code, notes, and snippets.

@user512
Last active September 12, 2015 18:58
Show Gist options
  • Select an option

  • Save user512/063d05495f7c406ca7ec to your computer and use it in GitHub Desktop.

Select an option

Save user512/063d05495f7c406ca7ec to your computer and use it in GitHub Desktop.
shortest question 6
square_of_sum = (1..100).reduce(:+) ** 2

sum_of_square = (1..100).inject {|sum, n| sum + n ** 2}

p square_of_sum - sum_of_square
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment