-
Notifications
You must be signed in to change notification settings - Fork 1
[WEEK09] 이지현 #41
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
[WEEK09] 이지현 #41
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,14 @@ | ||
| function capitalize(str) { | ||
| return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); | ||
| } | ||
|
|
||
| function solution(s) { | ||
| var answer = ""; | ||
| let word = []; | ||
|
|
||
| s = s.split(" "); | ||
| s.map((e) => word.push(capitalize(e))); | ||
|
Collaborator
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. map을 쓰셔서 뭔가 리턴하시려나보다 생각해서 변수를 빠뜨렷나 싶었어요ㅠ |
||
| answer = [...word].join(",").replaceAll(",", " "); | ||
|
Collaborator
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. join에서 바로 (" ") 요거는 안되는 건가요?! |
||
|
|
||
| return answer; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| function solution(s) { | ||
| var answer = true; | ||
| const stack = []; | ||
|
|
||
| for (let i = 0; i < s.length; i++) { | ||
| if (stack.length === 0 || s[i] === "(") { | ||
| stack.push(s[i]); | ||
| } else { | ||
| stack.pop(); | ||
| } | ||
| } | ||
|
Comment on lines
+5
to
+11
Collaborator
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. ")"가 먼저 채워지는 조건에서는 얼리 리턴으로 처리해주면 좋을 것 같아요! |
||
|
|
||
| answer = stack.length === 0 ? true : false; | ||
|
|
||
| return answer; | ||
| } | ||
|
Collaborator
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(s) { | ||
| var answer = ""; | ||
|
|
||
| let arr = s.split(" "); | ||
| arr = arr.sort((a, b) => Number(a) - Number(b)); | ||
| answer = arr[0] + " " + arr[arr.length - 1]; | ||
|
|
||
| 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.
항상 함수 분리를 깔끔하게 잘 하시는 군용!