Skip to content

[Yiseull] WEEK 04 Solutions#2755

Merged
Yiseull merged 8 commits into
DaleStudy:mainfrom
Yiseull:week4
Jul 18, 2026
Merged

[Yiseull] WEEK 04 Solutions#2755
Yiseull merged 8 commits into
DaleStudy:mainfrom
Yiseull:week4

Conversation

@Yiseull

@Yiseull Yiseull commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

Yiseull added 3 commits July 12, 2026 13:35
(cherry picked from commit 89322c3554301c0859b5e61e08d20f6ab995533e)
(cherry picked from commit c08337da842878a78cbf56d19d4f4618d8e6bb2e)
@dalestudy

dalestudy Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

📊 Yiseull 님의 학습 현황

이번 주 제출 문제

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

누적 학습 요약

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

문제 풀이 현황

카테고리 진행도 완료
Array ■■■■□□□ 5 / 10 (Medium 3, 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)
Tree ■□□□□□□ 1 / 14 (Medium 1)
Interval □□□□□□□ 0 / 5 ← 아직 시작 안 함
Linked List □□□□□□□ 0 / 6 ← 아직 시작 안 함
Matrix □□□□□□□ 0 / 4 ← 아직 시작 안 함

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,170 122 1,292 $0.000107
2 1,518 212 1,730 $0.000161
3 2,026 221 2,247 $0.000190
4 2,026 204 2,230 $0.000183
합계 6,740 759 7,499 $0.000641

@sangbeenmoon sangbeenmoon left a comment

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.

깔끔하게 잘 풀어주셨네요! 이번 한주도 고생 많으셨습니다 👍

@parkhojeong parkhojeong left a comment

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.

수고하셨습니다. 깔끔하게 풀어주신 거 같네요.

Comment on lines +14 to +22
if (nums[right] <= nums[left] && nums[left] <= nums[mid]) {
answer = Math.min(answer, nums[mid]);
left = mid + 1;
}
else {
answer = Math.min(answer, nums[mid]);
right = mid - 1;
}
}

@parkhojeong parkhojeong Jul 18, 2026

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.

탐색 중간에 답을 판별할 수 있어서 최적화 시도해보셔도 좋을 거 같습니다.

추가로 if (nums[right] <= nums[left] && nums[left] <= nums[mid]) { 는 조금 더 간소화 가능하니 생각해보셔도 좋을 듯 합니다.

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.

left, right를 비교해서 답을 바로 판별할 수 있네요! 말씀해주신 방향으로 최적화했습니다. 더 좋은 방향 제안해주셔서 감사합니다!👍

Comment thread coin-change/Yiseull.java
Comment on lines +6 to +19
int[] dp = new int[amount + 1];
Arrays.fill(dp, amount + 1);
dp[0] = 0;

for (int i = 1; i < amount + 1; i++) {
for (int coin : coins) {
if (coin <= i) {
dp[i] = Math.min(dp[i], dp[i - coin] + 1);
}
}
}

return dp[amount] > amount ? -1 : dp[amount];
}

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.

dp[amount] > amount가 실제로 amount + 1 인지를 비교하는 거고 amount + 1 이 매직넘버로 쓰이고 있어서 변수로 선언해서 쓰시면 더 좋을 거 같습니다

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/Yiseull.java Outdated
Comment on lines +7 to +12
Arrays.fill(dp, amount + 1);
dp[0] = 0;

for (int i = 1; i < amount + 1; i++) {
for (int coin : coins) {
if (coin <= i) {

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.

amount 보다 큰 coin 처리은 안쓰도록 해주면 최적화 가능할 거 같습니다

Comment thread coin-change/Yiseull.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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Dynamic Programming
  • 설명: 금액별 최소 동전 개수를 구하는 DP 아이디어로, 각 금액 i에 대해 모든 동전을 사용해 dp[i]를 갱신하는 전형적인 동적 계획법 문제의 풀이이다.

📊 시간/공간 복잡도 분석

복잡도
Time O(amount * C)
Space O(amount)

피드백: 금액마다 모든 동전을 고려해 dp[i]를 갱신한다. dp 배열 크기는 amount+1 이고, 외부 루프가 amount 번, 내부가 동전 수(C) 만큼 수행된다.

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

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

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)
Space 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)
Space O(h)

피드백: 노드 방문은 한 번씩 이루어지며, 재귀 스택은 트리의 높이 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, Linked List
  • 설명: 두 개의 정렬된 연결 리스트를 포인터 두 개로 순차적으로 비교해 작은 노드를 연결하는 방식으로 합치는 패턴이다. 리스트의 길이가 n, m일 때 선형 시간으로 동작한다.

📊 시간/공간 복잡도 분석

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

피드백: 두 리스트를 병합하여 비교적으로 선형 시간에 처리한다. 추가 노드 생성 없이 기존 노드를 연결한다.

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

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

Comment thread word-search/Yiseull.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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Backtracking, Depth-First Search, Hash Map / Hash Set
  • 설명: 단어를 보드에서 DFS로 탐색하며, 방문한 셀을 임시로 표시하고 되돌려 놓는 방식으로 모든 경로를 탐색한다. 이 풀이의 핵심은 재귀를 이용한 백트래킹으로 가능한 경로를 탐색하는 패턴이다.

📊 시간/공간 복잡도 분석

복잡도
Time O(4^(L) * M * N)
Space O(L)

피드백: 최악의 경우 모든 경로를 탐색하므로 지수적 시간 복잡도가 된다. 중복 방문 방지를 위해 방문 흔적을 남긴다.

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

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

@Yiseull
Yiseull merged commit 4ab4ada 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.

3 participants