Created
December 9, 2014 10:38
-
-
Save metallurgix/643ce3878ce9de0fbde5 to your computer and use it in GitHub Desktop.
Codility-Lesson 2-Challenge 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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