Last active
January 29, 2020 11:38
-
-
Save laddered/cf6f993f27eb9c1db370238163abe15b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function solution(A) { | |
A.sort(function(a,b){return a-b}) | |
count=0 | |
for(i=0; i<A.length; i++){ | |
if(A[i]===i+1){ | |
count++ | |
}else{ | |
break | |
} | |
} | |
if(count===A.length){ | |
return 1 | |
}else{ | |
return 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment