Merged
Conversation
sik9252
approved these changes
Mar 15, 2026
Collaborator
There was a problem hiding this comment.
저도 처음에 푸신거처럼 parseInt로 했었는데 길이의 한계가 있다해서 찾아보니까 BigInt로 변환하면 된다고 하드라구용 근데 실전에서 이렇게 풀어도 되려나 싶긴하네요ㅠ 그래도 일단 테스트 통과하는게 우선이니
Collaborator
There was a problem hiding this comment.
Diameter of Binary Tree도 DFS로 높이를 구하면서 diameter를 갱신하는 전형적인 O(n) 풀이로 잘 작성해주신 것 같아요. 기능적으로는 큰 수정 포인트는 없어 보이고, 전반적으로 코드가 간결해서 읽기 좋았습니다!
raejun92
approved these changes
Mar 16, 2026
Collaborator
raejun92
left a comment
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.
이렇게 풀었어요
1. Add Binary
1) 복잡도 계산
2) 접근 아이디어
carry를 관리하는 방식으로 풀려고 했다.parseInt)도 먼저 시도했다.3) 회고
이번 문제는 결국 못 풀었다 ㅠ
처음엔 단순 변환으로 끝내려고 했는데, 입력 길이가 길어질 때 한계가 있다는 걸 뒤늦게 깨달았다.
정답을 결국 보고 풀어봤는데, 오히려 이런 문제가 더 쥐약인듯..
아래 방식으로 문제를 풀어봤었다.
2. Diameter of Binary Tree
1) 복잡도 계산
2) 접근 아이디어
left + right를 해당 노드를 지나는 경로 길이로 보고, 전역 최대값(diameter)을 갱신했다.max(left, right) + 1만 반환해 재귀를 이어갔다.3) 회고
처음엔 지름을 "루트를 지나가는 경로"로만 생각해서 잘못 접근했다.
문제는 모든 노드가 지름 후보가 될 수 있다는 점을 놓치면 안 된다는 걸 다시 느꼈다.