Skip to content

[hyeri0903] WEEK 13 Solutions#2621

Open
hyeri0903 wants to merge 4 commits into
DaleStudy:mainfrom
hyeri0903:main
Open

[hyeri0903] WEEK 13 Solutions#2621
hyeri0903 wants to merge 4 commits into
DaleStudy:mainfrom
hyeri0903:main

Conversation

@hyeri0903
Copy link
Copy Markdown
Contributor

@hyeri0903 hyeri0903 commented May 30, 2026

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🏷️ 알고리즘 패턴 분석

  • 패턴: Binary Search, DFS
  • 설명: 이 코드는 이진 탐색 트리에서 중위 순회(DFS)를 통해 k번째 작은 값을 찾는 방식으로 동작하며, Binary Search와 DFS 패턴이 적용됩니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space O(h)

피드백: 이 구현은 재귀적 중위순회로, 최악의 경우 트리의 높이 h만큼의 스택 공간을 사용하며, 모든 노드를 방문하므로 시간 복잡도는 O(n)이다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🏷️ 알고리즘 패턴 분석

  • 패턴: Greedy
  • 설명: 이 코드는 겹치지 않는 구간을 찾기 위해 끝나는 시간 기준으로 정렬 후 선택하는 그리디 전략을 사용합니다. 최소 제거 개수를 구하는 문제에 적합한 패턴입니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n log n)
Space O(1)

피드백: intervals 배열을 정렬하는데 O(n log n) 시간이 소요되고, 이후 한 번 순회하며 겹침 여부를 체크하므로 전체 시간 복잡도는 O(n log n)이다. 공간은 정렬에 필요한 상수 공간만 사용한다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🏷️ 알고리즘 패턴 분석

  • 패턴: Two Pointers
  • 설명: 이 코드는 fast와 slow 두 포인터를 이용하여 리스트의 뒤에서 n번째 노드를 찾고 제거하는 방식으로, 두 포인터 패턴에 속합니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space O(1)

피드백: 이중 포인터를 사용하여 한 번의 순회로 해결하며, 리스트 길이와 상관없이 일정한 공간을 사용한다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

@dalestudy
Copy link
Copy Markdown
Contributor

dalestudy Bot commented May 30, 2026

📊 hyeri0903 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
kth-smallest-element-in-a-bst Medium ✅ 의도한 유형
non-overlapping-intervals Medium ✅ 의도한 유형
remove-nth-node-from-end-of-list Medium ✅ 의도한 유형
same-tree Easy ✅ 의도한 유형

누적 학습 요약

  • 풀이한 문제: 58 / 75개
  • 이번 주 유형 일치율: 100% (4문제 중 4문제 일치)

문제 풀이 현황

카테고리 진행도 완료
Array ■■■■■■■ 10 / 10 (Medium 7, Easy 3)
Linked List ■■■■■■■ 6 / 6 (Easy 3, Hard 1, Medium 2)
Dynamic Programming ■■■■■■□ 10 / 11 (Easy 1, Medium 9)
String ■■■■■■□ 9 / 10 (Medium 5, Hard 1, Easy 3)
Binary ■■■■■■□ 4 / 5 (Easy 3, Medium 1)
Graph ■■■■■□□ 6 / 8 (Medium 6)
Matrix ■■■■■□□ 3 / 4 (Medium 3)
Heap ■■■■■□□ 2 / 3 (Hard 1, Medium 1)
Tree ■■■■□□□ 7 / 14 (Hard 1, Medium 3, Easy 3)
Interval ■■■□□□□ 2 / 5 (Medium 2)

🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다.

🔢 API 사용량 (gpt-4.1-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,998 132 2,130 $0.000253

Comment thread same-tree/hyeri0903.java
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🏷️ 알고리즘 패턴 분석

  • 패턴: DFS
  • 설명: 이 코드는 재귀를 이용한 깊이 우선 탐색(DFS) 방식으로 두 트리의 구조와 값을 비교하여 동일한지 판단합니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space O(h)

피드백: 두 트리의 모든 노드를 방문하며, 최악의 경우 트리의 높이 h만큼의 재귀 호출 스택을 사용한다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Copy link
Copy Markdown
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

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

이번 주도 답안 제출하시느라 수고 많으셨습니다. 실제로 4문제를 푸셨는데 PR 설명에는 1문제만 푼 걸로 되어 있네요. 업데이트해주시면 좋을 것 같습니다.

Comment thread same-tree/hyeri0903.java
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

이 문제는 BST가 아니라 일반 binary tree 두 개가 같은지 확인하는 문제입니다. 구현은 일반 이진 트리 기준으로 올바르게 되어 있으니 주석만 수정하면 될 것 같습니다.

Suggested change
1.problem: 2개의 binary tree 동일한지 체크

Comment thread same-tree/hyeri0903.java
Comment on lines 38 to 41
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

이렇게 한 줄로 작성하면 더 간결할 것 같습니다.

Suggested change
return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Solving

Development

Successfully merging this pull request may close these issues.

2 participants