Merged
Conversation
tkddbs587
approved these changes
Feb 12, 2025
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.
📌 푼 문제
📝 간단한 풀이 과정
이진 트리의 최대 깊이
DFS(재귀)를 사용하여 루트에서 시작해 왼쪽과 오른쪽 서브트리의 깊이를 구하고 최대값을 반환하는 방식으로 해결했습니다.
이진 트리의 중위 순회
스택을 사용하여 트리를 왼쪽부터 탐색하고, 스택에서 값을 꺼내며 오른쪽으로 이동하는 방식으로 해결했습니다. 중위 순회의 순서를 유지하면서 노드 값을 배열에 추가하는 방식으로 동작합니다.
같은 트리인지 비교
두 트리를 동시에 순회하면서 재귀적으로 왼쪽과 오른쪽 서브트리를 비교하며 하나라도 다르면 false를 반환하는 방식으로 해결했습니다.
이진 트리 반전
각 노드에서 좌우를 교환한 후, DFS를 통해 재귀적으로 모든 노드에 대해 동일한 연산을 수행하는 방식으로 해결했습니다.
이진 트리 레벨 순서 순회
BFS(큐)를 사용하여 층별로 탐색하며, 각 층을 배열에 저장한 후 최종 결과를 반환하는 방식으로 해결했습니다.