Skip to content
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

Merged
merged 4 commits into from
Oct 5, 2024

Conversation

JEONGHWANMIN
Copy link
Contributor

@JEONGHWANMIN JEONGHWANMIN commented Oct 3, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@JEONGHWANMIN JEONGHWANMIN added the js label Oct 3, 2024
@JEONGHWANMIN JEONGHWANMIN self-assigned this Oct 3, 2024
@JEONGHWANMIN JEONGHWANMIN requested a review from a team as a code owner October 3, 2024 10:59
@JEONGHWANMIN JEONGHWANMIN changed the title [환미니니] 8주차 문제풀이 추가 [환미니니] 8주차 문제풀이 제출 Oct 3, 2024
@JEONGHWANMIN JEONGHWANMIN marked this pull request as draft October 3, 2024 11:00
Copy link
Contributor

@mangodm-web mangodm-web left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

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

clone graph 문제에서 해주신 것처럼 m, n을 무엇으로 정의했는지 적어주면 더 좋을 것 같아요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

좋습니다 ~


while (list1 && list2) {
if (list1.val < list2.val) {
res.next = new ListNode(list1.val);
Copy link
Contributor

Choose a reason for hiding this comment

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

지금은 순회를 할때마다 새로운 노드를 만들어서 할당하고 있어요.
이걸 개선할 수 있는 방법이 있을까요~? 🤔

Copy link
Contributor Author

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]
Copy link
Contributor

Choose a reason for hiding this comment

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

qqueue로 표현해준다면 더 가독성이 높아질 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

변수명 좀 더 신경써서 지어야겠어요👍

Comment on lines +25 to +36
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))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@JEONGHWANMIN JEONGHWANMIN marked this pull request as ready for review October 5, 2024 18:05
@JEONGHWANMIN JEONGHWANMIN merged commit e0acb77 into DaleStudy:main Oct 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants