Skip to content

[yuseok89] WEEK 06 Solutions - #2786

Merged
yuseok89 merged 7 commits into
DaleStudy:mainfrom
yuseok89:main
Aug 1, 2026
Merged

[yuseok89] WEEK 06 Solutions#2786
yuseok89 merged 7 commits into
DaleStudy:mainfrom
yuseok89:main

Conversation

@yuseok89

@yuseok89 yuseok89 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@yuseok89 yuseok89 self-assigned this Jul 31, 2026
@github-actions github-actions Bot added the py label Jul 31, 2026
@dalestudy

dalestudy Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

📊 yuseok89 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
container-with-most-water Medium ✅ 의도한 유형
design-add-and-search-words-data-structure Medium ✅ 의도한 유형
longest-increasing-subsequence Medium ✅ 의도한 유형
spiral-matrix Medium ✅ 의도한 유형
valid-parentheses Easy ✅ 의도한 유형

누적 학습 요약

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

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 313 56 369 $0.000038
2 313 37 350 $0.000030
3 1,760 200 1,960 $0.000168
4 1,726 198 1,924 $0.000166
5 1,726 251 1,977 $0.000187
6 1,726 252 1,978 $0.000187
합계 7,564 994 8,558 $0.000776

@yuseok89
yuseok89 marked this pull request as ready for review July 31, 2026 13:46

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.

제 생각에 너무 좋은 코드인데요, Python의 타입 힌팅을 적극적으로 이제 활용해 보시면 코드의 가독성에 큰 긍정적 영향을 줄것이라고 생각해요!
특히 메서드를 추가 작성할때 input param들의 타입과 return type을 작성하면 개인적으로는 상당한 가독성의 향상이 있다고 생각합니다.

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.

아 물론 개인적 의견이니 꼭 하실 필요는 없습니다!!!

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 spiral-matrix/yuseok89.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.

와 이건 코드를 아트의 경지로 올리셨군요 ㄷㄷㄷ 대단하십니다.
배우고 갑니다!

Comment thread valid-parentheses/yuseok89.py Outdated
if c in pars:
stack.append(c)
else:
if len(stack) == 0 or pars.get(stack.pop(), '') != c:

@alphaorderly alphaorderly Jul 31, 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 not stack or pars[stack.pop()] != c:
제 개인적인 생각으로는 이것으로 수정하면

  1. not stack 을 통해 스택이 비어있는 경우를 먼저 확인

단축 평가에 의해 stack이 비어 있으면 False를 리턴하기에 or의 뒤에 있는 부분은 실행시 stack에 값이 있음이 확실시 됩니다!

  1. pars[stack.pop()] != c

이부분은 stack에 값이 있음이 확실시 되고, 어차피 닫는 기호는 스택에 들어가지 않기 때문에 스택 내부에는 여는 기호만 있는것이 확실시 되기 때문에 get과 기본값을 명시하는것이 크게 필요하지 않다는 생각이 들었습니다.

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.

더 좋네요.
막 쓰다보니, 어차피 여는 기호만 있는 것을 기본값으로 처리해버렸네요.
리뷰 감사합니다 🙏

@alphaorderly alphaorderly 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.

전반적으로 깔끔한 풀이 잘 봤습니다!

@njngwn
njngwn self-requested a review July 31, 2026 18:08
Comment thread spiral-matrix/yuseok89.py
# TC: O(N*M)
# SC: O(N*M)
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:

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 thread container-with-most-water/yuseok89.py Outdated
else:
r -= 1

return ans;

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 thread valid-parentheses/yuseok89.py Outdated
@@ -0,0 +1,16 @@
# TC: O(N)
# SC: O(N/2)

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.

공간복잡도를 O(N/2) 라고 생각하신 이유가 있을까요?

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.

잘못 생각했었네요
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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Two Pointers, Greedy
  • 설명: 좌우 포인터를 이용해 서로를 좁혀가며 용량을 계산하는 방식으로 최댓값을 탐색합니다. 각 단계에서 더 작은 벽에 맞춰 포인터를 이동해 최적 해를 빨리 찾는 그리디 특성을 가집니다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(N) O(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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Trie, Backtracking, Dynamic Programming
  • 설명: 코드는 트라이(Trie) 자료구조를 활용해 단어를 저장하고 검색합니다. 검색에서 '.' 와일드카드를 재귀적으로 대입해 가능한 경로를 탐색하므로 부분적으로 백트래킹 패턴이 보이고, 트라이 기반의 저장과 탐색으로 문제의 문자열 매칭을 구현합니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(len(word))
Space O(total_chars_inserted)

피드백: 트라이 구조로 단어를 저장하고 와일드카드를 재귀로 확장 탐색한다.

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

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

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, Dynamic Programming
  • 설명: LIS 길이를 이분 탐색으로 최적화하는 대표적인 방법으로, arr를 유지하며 각 원소의 삽입 위치를 이분 탐색으로 찾는 패턴입니다. 이로써 O(N log N) 시간 복잡도가 가능해집니다.

📊 시간/공간 복잡도 분석

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

피드백: 이분검색으로 LIS의 길이를 효율적으로 관리한다.

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

Comment thread spiral-matrix/yuseok89.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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Two Pointers, Monotonic Stack, Hash Map / Hash Set, Greedy, Divide and Conquer, Binary Search, Dynamic Programming, Breadth First Search, Depth First Search, Backtracking, Union Find, Trie, Bit Manipulation, Heap / Priority Queue, Sliding Window, Fast & Slow Pointers, DFS, BFS
  • 설명: 해당 코드는 행렬을 순회하여 나선형으로 방문하는 방식으로 인덱스를 좌우로 움직이며 모든 원소를 연속적으로 수집한다. 방향 전환과 경계 축소를 반복하는 구조는 Two Pointers의 응용으로 볼 수 있다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(N*M) O(n*m)
Space O(N*M) 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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Stack, Hash Map / Hash Set
  • 설명: 괄호 유효성 검사에서 스택을 이용해 여는 괄호를 저장하고 닫는 괄호가 올바르게 매칭되는지 확인하므로 Stack 패턴에 해당하며, 매칭 규칙을 해시맵으로 빠르게 조회하므로 Hash Map / Hash Set 패턴도 함께 해당됩니다.

📊 시간/공간 복잡도 분석

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

피드백: 문자열을 한 번 순회하며 스택으로 매칭 여부를 판단한다.

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

@yuseok89
yuseok89 merged commit 8c4ebb2 into DaleStudy:main Aug 1, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Aug 1, 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