Skip to content

Instantly share code, notes, and snippets.

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