[liza0525] WEEK 14 Solutions#2629
Open
liza0525 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
🏷️ 알고리즘 패턴 분석
- 패턴: BFS, DFS
- 설명: 이 코드는 트리의 레벨별 순회를 위해 BFS와 DFS 방식을 모두 사용하며, 각각 큐와 재귀 호출을 활용하는 대표적인 트리 탐색 패턴입니다.
📊 시간/공간 복잡도 분석
ℹ️ 이 파일에는 2가지 풀이가 포함되어 있어 각각 분석합니다.
풀이 1: Solution.levelOrder — Time: ✅ O(n) → O(n) / Space: ✅ O(w) → O(w)
| 유저 분석 | 실제 분석 | 결과 | |
|---|---|---|---|
| Time | O(n) | O(n) | ✅ |
| Space | O(w) | O(w) | ✅ |
피드백: 큐를 이용한 BFS 탐색으로 모든 노드를 한 번씩 방문하며, 최대 노드 수(w)에 비례하는 공간을 사용합니다.
개선 제안: 현재 구현이 적절해 보입니다.
풀이 2: Solution.levelOrder — Time: ✅ O(n) → O(n) / Space: ✅ O(h) → O(h)
| 유저 분석 | 실제 분석 | 결과 | |
|---|---|---|---|
| Time | O(n) | O(n) | ✅ |
| Space | O(h) | O(h) | ✅ |
피드백: 재귀 호출 스택이 트리의 높이(h)에 비례하며, 모든 노드를 한 번씩 방문합니다.
개선 제안: 현재 구현이 적절해 보입니다.
Contributor
There was a problem hiding this comment.
🏷️ 알고리즘 패턴 분석
- 패턴: Dynamic Programming
- 설명: 이 코드는 이전 결과를 활용하여 현재 값을 계산하는 DP 방식을 사용하며, 최적의 중복 계산 방지와 효율성을 보여줍니다.
📊 시간/공간 복잡도 분석
| 유저 분석 | 실제 분석 | 결과 | |
|---|---|---|---|
| Time | O(n) | O(n) | ✅ |
| Space | O(n) | O(n) | ✅ |
피드백: DP 배열을 이용하여 이전 결과를 활용하며, 모든 수에 대해 한 번씩 계산합니다.
개선 제안: 현재 구현이 적절해 보입니다.
Contributor
📊 liza0525 님의 학습 현황이번 주 제출 문제
누적 학습 요약
문제 풀이 현황
🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다. 🔢 API 사용량 (gpt-4.1-nano)
|
reeseo3o
approved these changes
Jun 6, 2026
| @@ -0,0 +1,56 @@ | |||
| # 7기 풀이 | |||
| class Solution: | |||
Contributor
There was a problem hiding this comment.
BFS와 DFS 두 가지 방식으로 레벨 순회를 모두 잘 구현해 주셔서, 트리 탐색 패턴을 비교하면서 학습하기 좋은 코드였어요 👍
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 하나 이상을 반드시 검토를 해주셔야 합니다!