-
다음 큰 숫자 [JavaScript]2018~2019/Level 2 2018. 10. 1. 23:03
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
function solution(n) { var answer = 0; var check = true; var cnt = n.toString(2).split(1).length; while(check) { n++; if(cnt === n.toString(2).split(1).length) { answer = n; check = false; } } return answer; }
'2018~2019 > Level 2' 카테고리의 다른 글
숫자의 표현 [Python3] (0) 2018.10.03 올바른 괄호 [Python3] (0) 2018.10.02 위장 [Python3] (0) 2018.10.01 전화번호 목록 [Python3] (0) 2018.10.01 주식 가격 [Python3] (0) 2018.10.01