Skip to content

Instantly share code, notes, and snippets.

@metallurgix
Created December 9, 2014 11:35
Show Gist options
  • Save metallurgix/8f133292fdf7f484f4fb to your computer and use it in GitHub Desktop.
Save metallurgix/8f133292fdf7f484f4fb to your computer and use it in GitHub Desktop.
Codility-Lesson 1-Challenge 3
def solution(a)
if a.length==0
1
else
sum=a.inject(:+)
((a.length+1)*(a.length+2)/2)-sum
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment