[devyejin] WEEK 04 solutions #1824
Merged
devyejin merged 9 commits intoDaleStudy:mainfrom Aug 17, 2025
Merged
Conversation
printjin-gmailcom
approved these changes
Aug 16, 2025
| @@ -0,0 +1,12 @@ | |||
| # Definition for a binary tree node. | |||
Contributor
There was a problem hiding this comment.
깊은 트리에서는 Python recursion limit 문제 발생 가능 → BFS나 stack 기반 DFS 방식도 고려하면 좋음.
Contributor
Author
There was a problem hiding this comment.
습관적으로 DFS 쓰게되는데 다른 방식 추천 감사합니다!
merge-two-sorted-lists/devyejin.py
Outdated
|
|
||
| class Solution: | ||
| def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: | ||
| dummy = ListNode(None) |
Contributor
There was a problem hiding this comment.
dummy = ListNode(None) → dummy = ListNode() 추천
ListNode 기본값이 val=0인데 굳이 None을 주면 타입 일관성이 깨질 수 있음
Contributor
Author
There was a problem hiding this comment.
이 부분에 대해 생각을 못했는데 꼼꼼한 리뷰 감사합니다! 😄
sonjh1217
approved these changes
Aug 16, 2025
| if not root: | ||
| return 0 | ||
|
|
||
| return max(self.maxDepth(root.left), self.maxDepth(root.right)) + 1 |
Contributor
There was a problem hiding this comment.
시잔&공간복잡도를 일관적으로 작성해보시는 것도 추천드립니다. 자꾸 하다보니 복잡도 계산이 전보다 쉬워지더라구요.
Contributor
Author
There was a problem hiding this comment.
맞아요! 조언 감사합니다~ 앞으로 꾸준히 작성해볼게요 🥰
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!