Skip to content

Instantly share code, notes, and snippets.

@laddered
Last active January 29, 2020 11:38
Show Gist options
  • Save laddered/cf6f993f27eb9c1db370238163abe15b to your computer and use it in GitHub Desktop.
Save laddered/cf6f993f27eb9c1db370238163abe15b to your computer and use it in GitHub Desktop.
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