Skip to content

[devyejin] WEEK 04 solutions #1824

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

Merged
merged 9 commits into from
Aug 17, 2025
Merged

[devyejin] WEEK 04 solutions #1824

merged 9 commits into from
Aug 17, 2025

Conversation

devyejin
Copy link
Contributor

@devyejin devyejin commented Aug 14, 2025

답안 제출 문제

작성자 체크 리스트

  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

Copy link
Contributor

@printjin-gmailcom printjin-gmailcom left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 :)

@@ -0,0 +1,12 @@
# Definition for a binary tree node.
Copy link
Contributor

Choose a reason for hiding this comment

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

깊은 트리에서는 Python recursion limit 문제 발생 가능 → BFS나 stack 기반 DFS 방식도 고려하면 좋음.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

습관적으로 DFS 쓰게되는데 다른 방식 추천 감사합니다!


class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
dummy = ListNode(None)
Copy link
Contributor

Choose a reason for hiding this comment

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

dummy = ListNode(None) → dummy = ListNode() 추천
ListNode 기본값이 val=0인데 굳이 None을 주면 타입 일관성이 깨질 수 있음

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이 부분에 대해 생각을 못했는데 꼼꼼한 리뷰 감사합니다! 😄

Copy link
Contributor

@sonjh1217 sonjh1217 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다

if not root:
return 0

return max(self.maxDepth(root.left), self.maxDepth(root.right)) + 1
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.

맞아요! 조언 감사합니다~ 앞으로 꾸준히 작성해볼게요 🥰

@devyejin devyejin moved this from Solving to In Review in 리트코드 스터디 5기 Aug 17, 2025
@devyejin devyejin merged commit 23cbc9b into DaleStudy:main Aug 17, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 5기 Aug 17, 2025
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.

3 participants