Created
March 28, 2018 10:05
-
-
Save amorfati0310/c80571eb50f1709c5aeeab1ad3f3d158 to your computer and use it in GitHub Desktop.
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
https://app.codility.com/demo/results/trainingQSUQJ3-KVW/ | |
function solution(A) { | |
const numbers = [...Array(A.length).keys()].map(x => x + 1) | |
A.sort((a, b) => a - b); | |
if (A.join('') == numbers.join('')) return 1 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
좀 야메로 푼 것 같다. join보다 .toString을 쓰면 더 좋을 것 같다. 검색해서 빈문자열 기준으로 합치는 것보다 단순 문자열 변환이 쉬울테니
로직적으로도 다시 시도 해볼 것 !!!