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 a6cc9e8

Browse files
Update 이진-변환-반복하기&70129&.js
풀이 추가
1 parent bf55435 commit a6cc9e8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎level-2/이진-변환-반복하기&70129&.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,15 @@ function solution(s) {
1818

1919
return convertToBinary(s, 0, 0);
2020
}
21+
22+
// 정답 2 - RyanDeclan
23+
function solution(s) {
24+
let box = [0,0]
25+
while(s.length > 1){
26+
let reamain = s.replace(/0/g,"").length
27+
box[0] += 1
28+
box[1] += (s.length - reamain)
29+
s = reamain.toString(2)
30+
}
31+
return box;
32+
}

0 commit comments

Comments
(0)

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