Skip to content

Commit

Permalink
#8 22.05.17 > 2번 이진수 출력
Browse files Browse the repository at this point in the history
  • Loading branch information
beurmuz committed May 17, 2022
1 parent cbce3fb commit 6f71897
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/inf/recursive,dfs/2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

function solution(n) {
let answer = '';
function recursive(n) {
if(n === 0) {
return;
} else {
// console.log()시 순차 출력
recursive(parseInt(n/2));
answer += String(n%2); // 여기서 출력하면 거꾸로 나옴
}
}
recursive(n);
return answer;
}

console.log(solution(11));
2 changes: 1 addition & 1 deletion src/inf/recursive,dfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
|번호|정답여부|재응시|
|:---:|:---:|:---:|
|1||한번 더 풀기|
|2|||
|2|O|한번 더 풀기|
|3|||
|4|||
|5|||
Expand Down

0 comments on commit 6f71897

Please sign in to comment.