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
Last active
September 12, 2015 18:58
-
-
Save user512/063d05495f7c406ca7ec to your computer and use it in GitHub Desktop.
shortest question 6
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment