Created
March 28, 2018 12:50
-
-
Save amorfati0310/3aec61884eca646e2af6b575a9e52415 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
function solution(A) { | |
// write your code in JavaScript (Node.js 8.9.4) | |
const dicA = A.reduce((ac, c) => { | |
ac[c] = c | |
return ac; | |
}, {}) | |
for (let i = 1; i <= A.length + 1; i++) { | |
if (dicA[i] !== i) return i; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
8번째줄 if문을
if(!dicA[i])
로만 해도 될거 같아요!