-
Notifications
You must be signed in to change notification settings - Fork 3
week 38 - 40 문제풀이 완료!
#213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| const readline = require("readline"); | ||
| const rl = readline.createInterface({ | ||
| input: process.stdin, | ||
| output: process.stdout, | ||
| }); | ||
|
|
||
| let input = []; | ||
|
|
||
| rl.on("line", function (line) { | ||
| input = line.split(" "); | ||
| }).on("close", function () { | ||
| const N = Number(input[0]); | ||
| let answer = ""; | ||
| for (let i = 1; i <= N; i++) { | ||
| answer += "*"; | ||
| console.log(answer); | ||
| } | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| function solution(my_string) { | ||
| return my_string.toLowerCase().split("").sort().join(""); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| function solution(my_string, is_prefix) { | ||
| const prefix = []; | ||
| let element = ""; | ||
| for (let i of my_string) { | ||
| element += i; | ||
| prefix.push(element); | ||
| } | ||
| return prefix.includes(is_prefix) ? 1 : 0; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| function solution(my_string, index_list) { | ||
| return index_list.map((item, idx) => my_string[item]).join(""); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| function solution(my_string, k) { | ||
| return my_string.repeat(k); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| function solution(num_list) { | ||
| const plus = num_list.reduce((acc, cur) => acc + cur, 0) ** 2; | ||
| const multiple = num_list.reduce((acc, cur) => acc * cur); | ||
|
Comment on lines
+2
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 확실히 |
||
| return multiple < plus ? 1 : 0; | ||
|
Comment on lines
+2
to
+4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| function solution(a, b) { | ||
| const NUM_ARR = [a, b].sort((a, b) => a - b); | ||
| let answer = NUM_ARR[0]; | ||
| if (a === b) return a; | ||
| for (let i = NUM_ARR[0] + 1; i <= NUM_ARR[1]; ++i) { | ||
| answer += i; | ||
| } | ||
| return answer; | ||
| } |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 수진님 객체로 풀었네요~! 👍 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| function solution(s) { | ||
| const lowerCase = s.toLowerCase(); | ||
| const compare = { p: 0, y: 0 }; | ||
| for (let i of lowerCase) { | ||
| if (i === "p") { | ||
| compare.p += 1; | ||
| } else if (i === "y") { | ||
| compare.y += 1; | ||
| } | ||
| } | ||
| return compare.p === compare.y; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| function solution(absolutes, signs) { | ||
| let answer = 0; | ||
| signs.forEach((item, idx) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| item ? (answer += absolutes[idx]) : (answer += -absolutes[idx]); | ||
| }); | ||
| return answer; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
includes()를 사용해주셨군용