Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0a7bb6d

Browse files
Update 다음-큰-숫자&12911&.js
1 parent b44d07f commit 0a7bb6d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎level-2/다음-큰-숫자&12911&.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,10 @@ function solution(n) {
4141
const value = i.toString(2).match(/1/g).length;
4242
if(n === value) return i;
4343
}
44-
}
44+
}
45+
46+
//정답 4 = ryan-dia
47+
function solution(n) {
48+
const count = (num) => num.toString(2).match(/1/g).length;
49+
for(i=(n+1); i< 1_000_000; i++) if(count(n) == count(i)) return i
50+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /