Skip to content

Instantly share code, notes, and snippets.

@amorfati0310
Created March 28, 2018 10:05
Show Gist options
  • Save amorfati0310/c80571eb50f1709c5aeeab1ad3f3d158 to your computer and use it in GitHub Desktop.
Save amorfati0310/c80571eb50f1709c5aeeab1ad3f3d158 to your computer and use it in GitHub Desktop.
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;
}
@amorfati0310
Copy link
Author

amorfati0310 commented Mar 29, 2018

좀 야메로 푼 것 같다. join보다 .toString을 쓰면 더 좋을 것 같다. 검색해서 빈문자열 기준으로 합치는 것보다 단순 문자열 변환이 쉬울테니
로직적으로도 다시 시도 해볼 것 !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment