Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions level-1/x만큼-간격이-있는-n개의-숫자.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,7 @@ function solution(x, n) {
return answer;
}

//정답 3 - jaewon1676
function solution(n) {
let str = '';
for (let i=0; i<n; i++){
// 삼항 연산자와 +로 문자열을 붙여주어 추가.
(i % 2 == 0 ? str = str + '수' : str = str + '박')
}
return str;
}

// 정답 4 - prove-ability
// 정답 3 - prove-ability
function solution(x, n) {
var answer = [];
let i = 1;
Expand All @@ -42,4 +32,4 @@ function solution(x, n) {
i++;
}
return answer;
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

찾아주셔서 감사합니다! 더 꼼꼼히 리뷰해야겠네요!! 😿

16 changes: 15 additions & 1 deletion level-1/직사각형-별찍기.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,18 @@ process.stdin.on('data', data => {
result += "\n";
}
console.log(result)
});
});

//정답 3 - yongchanson
process.stdin.setEncoding("utf8");
process.stdin.on("data", (data) => {
const n = data.split(" ");
const a = Number(n[0]),
b = Number(n[1]);
console.log(("*".repeat(a) + `\n`).repeat(b));
});
/*
<풀이과정>
repeat() 메서드는 문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열을 반환한다. ex) str.repeat(count);
'*'.repeat(a) : *를 a만큼 반복한다.
*/
Comment on lines +51 to +54
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

풀이 과정 적어주신 것 너무 좋습니다 👍 👍

14 changes: 12 additions & 2 deletions level-1/콜라츠-추측.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function solution(num) {
return num == 1 ? answer : -1
}

//정답 3 - prove-ability
//정답 4 - prove-ability
function solution(num) {
let count = 0;

Expand All @@ -62,4 +62,14 @@ function solution(num) {
}

return count;
}
}

//정답 5 - yongchanson
function solution(num) {
let count = 0;
while (num !== 1) {
if (count++ === 500) return -1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ 연산자를 활용한 풀이 너무 깔끔한데요? 배워갑니다 😄

num = num % 2 ? num * 3 + 1 : num / 2;
}
return count;
}