-
Notifications
You must be signed in to change notification settings - Fork 126
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
[환미니니] 8주차 문제풀이 제출 #509
[환미니니] 8주차 문제풀이 제출 #509
Conversation
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.
환미니니님, 안녕하세요!
작성해주신 코드 잘 보았습니다. 😊
전체적으로 코드가 깔끔하게 작성되어 있어서 리뷰가 수월했습니다. 또한, 저는 Clone Graph 문제를 풀지 못했었는데, 리뷰하면서 접근 방법에 대한 아이디어를 얻은 것 같아요. 감사 드립니다!
몇 가지 사항에 대해 코멘트를 남겨두었으니, 나중에 한번 확인 부탁드립니다.
이번 주도 고생 많으셨습니다. 마지막까지 화이팅입니다! 🙇♀️
@@ -0,0 +1,37 @@ | |||
// 시간복잡도: O(m + n) |
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.
clone graph 문제에서 해주신 것처럼 m, n을 무엇으로 정의했는지 적어주면 더 좋을 것 같아요.
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.
좋습니다 ~
merge-two-sorted-lists/hwanmini.js
Outdated
|
||
while (list1 && list2) { | ||
if (list1.val < list2.val) { | ||
res.next = new ListNode(list1.val); |
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.
지금은 순회를 할때마다 새로운 노드를 만들어서 할당하고 있어요.
이걸 개선할 수 있는 방법이 있을까요~? 🤔
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.
아 기존 리스트 노드를 재활용하면 되겠네요..!
감사합니다 : )
const visited = new Map() | ||
visited.set(node, new _Node(node.val)) | ||
|
||
const que = [node] |
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.
q
나 queue
로 표현해준다면 더 가독성이 높아질 것 같아요!
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.
변수명 좀 더 신경써서 지어야겠어요👍
while (que.length) { | ||
const curNode = que.shift() | ||
|
||
for (neighbor of curNode.neighbors) { | ||
if (!visited.has(neighbor)) { | ||
visited.set(neighbor, new _Node(neighbor.val)); | ||
que.push(neighbor) | ||
} | ||
|
||
visited.get(curNode).neighbors.push(visited.get(neighbor)) | ||
} | ||
} |
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.
👍
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.