-
-
Notifications
You must be signed in to change notification settings - Fork 247
[jongwanra] WEEK 04 Solutions #1819
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
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.
수고하셨습니다 :)
if node.right: | ||
dfs(depth + 1, node.right) | ||
|
||
if not root: |
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.
이 부분은 문제 없지만, root가 없는 경우는 이미 위에서 처리했기 때문에 if not node: 로 처리해도 더 범용적
current_node = dummy_head | ||
while list1 and list2: | ||
if list1.val > list2.val: | ||
current_node.next = ListNode(list2.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.
기존 노드를 재사용하지 않고 새 노드를 계속 생성 → 메모리 낭비
return dummy_head.next | ||
|
||
def print_list(node:Optional[ListNode])->None: | ||
list = [] |
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.
list라는 변수명이 Python 내장 타입과 충돌
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!