Skip to content

[okyungjin] WEEK 04 Solutions#2743

Merged
okyungjin merged 9 commits into
DaleStudy:mainfrom
okyungjin:main
Jul 18, 2026
Merged

[okyungjin] WEEK 04 Solutions#2743
okyungjin merged 9 commits into
DaleStudy:mainfrom
okyungjin:main

Conversation

@okyungjin

@okyungjin okyungjin commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

📊 okyungjin 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
coin-change Medium ✅ 의도한 유형
find-minimum-in-rotated-sorted-array Medium ✅ 의도한 유형
maximum-depth-of-binary-tree Easy ✅ 의도한 유형
merge-two-sorted-lists Easy ✅ 의도한 유형
word-search Medium ✅ 의도한 유형

누적 학습 요약

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

문제 풀이 현황

카테고리 진행도 완료
Array ■■■□□□□ 4 / 10 (Medium 2, Easy 2)
Heap ■■□□□□□ 1 / 3 (Medium 1)
Dynamic Programming ■■□□□□□ 3 / 11 (Easy 1, Medium 2)
Binary ■□□□□□□ 1 / 5 (Easy 1)
String ■□□□□□□ 2 / 10 (Easy 2)
Graph ■□□□□□□ 1 / 8 (Medium 1)
Interval □□□□□□□ 0 / 5 ← 아직 시작 안 함
Linked List □□□□□□□ 0 / 6 ← 아직 시작 안 함
Matrix □□□□□□□ 0 / 4 ← 아직 시작 안 함
Tree □□□□□□□ 0 / 14 ← 아직 시작 안 함

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,200 37 1,237 $0.000075
2 1,196 46 1,242 $0.000078
3 1,620 84 1,704 $0.000115
4 2,173 147 2,320 $0.000167
5 2,863 228 3,091 $0.000234
6 3,508 215 3,723 $0.000261
7 3,905 209 4,114 $0.000279
8 3,954 204 4,158 $0.000279
9 3,954 256 4,210 $0.000300
10 3,954 204 4,158 $0.000279
합계 28,327 1,630 29,957 $0.002068

@github-actions github-actions Bot added the py label Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@DaleStudy 개선 제안: 더 나은 변수 네이밍과 주석 정리로 가독성을 높일 수 있습니다. 는 어떤 방식을 말하는건지 제안해주라

Comment thread merge-two-sorted-lists/okyungjin.py
@ICE0208
ICE0208 self-requested a review July 14, 2026 04:20

# 값을 비교해서 작은 값을 next 노드에 추가한다.
if list1.val <= list2.val:
node.next = ListNode(list1.val)

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.

이 부분에서 ListNode(list1.val)로 매번 새 노드를 생성하시는데, 기존 노드를 그대로 연결(node.next = list1)하면 새 노드를 안 만들어도 돼서 공간 복잡도를 O(1)로 줄일 수 있을 것 같아요. 저는 그렇게 풀었는데 참고하시라고 남깁니다! 전체 로직은 깔끔하게 잘 읽혔어요 👍

@okyungjin okyungjin Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@chapse57 코멘트 감사합니다! 풀이를 2가지로 작성했는데 이 부분 언급해주신게 맞을까요?

https://github.com/okyungjin/leetcode-study/blob/f24511286b1f9519e87e5d64fdb19e3648658584/merge-two-sorted-lists/okyungjin.py#L72-L99

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@DaleStudy 내가 의도한 유형으로 안 풀었어?

Comment thread word-search/okyungjin.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@DaleStudy 시간 복잡도랑 공간 복잡도 어떻게 계산했어? 과정 알려줘

@okyungjin okyungjin moved this from Solving to In Review in 리트코드 스터디 8기 Jul 18, 2026
Comment thread coin-change/okyungjin.py

@ICE0208 ICE0208 left a comment

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.

안녕하세요. 이번 주 리뷰를 담당한 ICE0208입니다.

각 풀이의 주석이 잘 정리되어 있었고, 구현 방식도 제가 푼 방식과 유사해 비교하며 이해하기 쉬웠습니다. 몇 가지 의견은 코멘트로 남겼습니다.

이번 주도 고생 많으셨습니다! 👍

Comment on lines +15 to +21
max_depth = 1
queue = [(root, 1)]

while queue:
node, cur_depth = queue.pop()
max_depth = max(cur_depth, max_depth)

@ICE0208 ICE0208 Jul 18, 2026

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.

현재 구현은 LIFO 방식으로 동작하므로, 변수 이름도 queue보다 stack이 자연스러울 것 같습니다!

반대로 FIFO 방식의 큐로 구현한다면 노드가 깊이 순서대로 처리되므로, max()를 사용하지 않고 max_depth = cur_depth로 갱신하는 것만으로도 충분할 것 같습니다.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ICE0208 놓친 부분 짚어주셔서 감사합니다!

@okyungjin okyungjin Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

stack으로 변수명 수정했습니다(6808c86)

감사합니다!

Comment thread word-search/okyungjin.py

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.

DFS를 시작하기 전에 단어의 길이가 보드 전체 칸 수보다 긴지 확인하면, 경로를 만들 수 없는 입력을 탐색 전에 바로 제외할 수 있을 것 같습니다!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

좋은 의견 감사합니다!

Comment thread coin-change/okyungjin.py

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Dynamic Programming
  • 설명: 금액(amount)을 만들기 위한 최소 동전 수를 DP 배열로 관리하며, 각 금액에 대해 모든 동전을 사용해 최적 값을 갱신하는 전형적인 동적계획(Dynamic Programming) 풀이이다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(A * C) O(A * C)
Space O(A) O(A)

피드백: 금액별로 모든 동전을 시도해 최소값을 갱신하는 DP 풀이로 문제의 조건에 맞는 최단 동전 수를 구한다.

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

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
  • 설명: 정렬된 배열이 회전되었을 때 최소값을 찾기 위해 중간값과 양 끝 값을 비교해 탐색 범위를 반으로 줄이는 이진 탐색 패턴을 사용한다. 시간 복잡도 O(log n)으로 풀이한다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(log n) O(log n)
Space O(1) O(1)

피드백: 정렬된 배열이 회전되었을 때 중간값과 끝 값을 비교해 탐색 범위를 절단한다.

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

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Depth-First Search, Binary Search
  • 설명: 주어진 코드는 스택을 이용한 깊이 우선 탐색(DFS)으로 트리를 순회하며 최대 깊이를 계산한다. 재귀 대신 명시적 스택으로 노드를 방문해 깊이를 추적하는 패턴이다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(N) O(n)
Space O(N) O(h)

피드백: 스택을 사용해 각 노드의 깊이를 관리하여 전체 트리를 탐색한다.

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

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, Monotonic Stack, Hash Map / Hash Set
  • 설명: 두 정렬 리스트를 순차적으로 비교하며 작은 값을 연결하는 방식으로 문제를 풀이한다. 포인터를 두 개 사용해 서로의 노드를 탐색하는 전형적인 Two Pointers 패턴이다. 또한 더미 노드를 활용해 구현을 간단하게 만드는 점은 구현 기법에 해당한다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(n + m) O(n + m)
Space O(1) O(1)

피드백: 둘 다 선형 시간복잡도로 병합하며, 메모리 사용은 노드 재사용 여부에 따라 달라진다.

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

Comment thread word-search/okyungjin.py

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Depth-First Search, Backtracking, Hash Map / Hash Set
  • 설명: DFS를 이용한 탐색과 백트래킹으로 각 문자 매칭 시 분기점을 따라 보드를 탐색한다. 중복 방문 방지를 위해 방문 표를 사용하거나 문자열 대체로 백트래킹을 구현한다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(m * n * 4^L) O(m * 4^L)
Space O(L) O(L)

피드백: SolutionA는 방문 배열을 사용하고, Solution은 보드를 직접 마킹해 공간을 절약한다.

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

@okyungjin
okyungjin merged commit 5baef7a into DaleStudy:main Jul 18, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

4 participants