Skip to content

[okyungjin] WEEK 05 Solutions#2763

Merged
okyungjin merged 10 commits into
DaleStudy:mainfrom
okyungjin:main
Jul 25, 2026
Merged

[okyungjin] WEEK 05 Solutions#2763
okyungjin merged 10 commits into
DaleStudy:mainfrom
okyungjin:main

Conversation

@okyungjin

@okyungjin okyungjin commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

📊 okyungjin 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
best-time-to-buy-and-sell-stock Easy ✅ 의도한 유형
encode-and-decode-strings Medium ✅ 의도한 유형
group-anagrams Medium ✅ 의도한 유형
implement-trie-prefix-tree Medium ✅ 의도한 유형
word-break Medium ✅ 의도한 유형

누적 학습 요약

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

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,121 145 1,266 $0.000114
2 1,121 140 1,261 $0.000112
3 1,902 211 2,113 $0.000180
4 1,886 190 2,076 $0.000170
5 2,967 203 3,170 $0.000230
6 3,391 225 3,616 $0.000260
7 3,551 224 3,775 $0.000267
합계 15,939 1,338 17,277 $0.001332

@daehyun99
daehyun99 self-requested a review July 20, 2026 13:41

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.

sorted를 쓰는것도 좋지만, 정렬 자체가 N Log N 시간복잡도를 가져서
해시 함수를 구현해서 O(N) 시간복잡도로 구현하는것도 좋은것 같더라구요!

  • 지금 봇에 댓글 달면 사라지는 버그 있어서 혹시 몰라 새로 답니다!

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.

sorted를 쓰는것도 좋지만, 정렬 자체가 N Log N 시간복잡도를 가져서 해시 함수를 구현해서 O(N) 시간복잡도로 구현하는것도 좋은것 같더라구요!

  • 지금 봇에 댓글 달면 사라지는 버그 있어서 혹시 몰라 새로 답니다!

@alphaorderly 감사합니다 ㅎㅎ 문제 쫙 풀고 최적화 해보도록 하겠습니다 👍👍👍

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.

84fbf28

카운터 리스트를 튜플로 변환한 다음에 키로 사용하도록 최적화했습니다.
알고달레 찾아보니 Counter + fronzenset 방식도 사용이 가능하네요. 피드백 감사합니다!

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 자료구조가 추구하는 방향과는 전혀 맞지 않는것이 너무 아쉽네요 ㅠㅠ
링크

해당 자료구조는 tree의 형태에 좀 더 가까운 자료구조고, 지금처럼 모든 prefix의 경우를 저장하시지 않으시더라도 최적의 시간으로 구할수 있게 해줘서 좋아요!
꼭!! 구현 해보시길 바랍니다!

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.

문제의 목표에는 꽤나 잘 맞도록 잘 구현해 주셨는데요! Trie 자료구조가 추구하는 방향과는 전혀 맞지 않는것이 너무 아쉽네요 ㅠㅠ 링크

해당 자료구조는 tree의 형태에 좀 더 가까운 자료구조고, 지금처럼 모든 prefix의 경우를 저장하시지 않으시더라도 최적의 시간으로 구할수 있게 해줘서 좋아요! 꼭!! 구현 해보시길 바랍니다!

@alphaorderly 오 맞아요... 사실 문제를 풀고나서 위키 문서를 보게 되었는데 최초에 생각한 구현이랑 방향성이 많이 다르더라구요. 내일 저녁 먹고 이어서 풀어보겠습니다 감사합니다 🔥

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.

52ec553 커밋에서 적용했습니다.
wordBreak에서 이 자료구조를 활용할 수 있더라구요. 피드백 감사합니다!

@DaleStudy DaleStudy deleted a comment from okyungjin Jul 20, 2026
@DaleStudy DaleStudy deleted a comment from okyungjin Jul 20, 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.

엄청 깔끔하게 잘 해결하셨네요!
best time to buy and sell stock, 즉 해당 문제는
뒤에 로마 숫자를 붙혀서 1, 2, 3, 4, 5 총 다섯종류가 있는데요
dp 연습하기에 정말 괜찮은 문제라고 생각해서
2번문제
II는 한번 풀어보시길 추천드려요!

@okyungjin okyungjin moved this from Solving to In Review in 리트코드 스터디 8기 Jul 25, 2026
Comment thread best-time-to-buy-and-sell-stock/okyungjin.py
Comment thread encode-and-decode-strings/okyungjin.py
Comment thread group-anagrams/okyungjin.py
Comment thread implement-trie-prefix-tree/okyungjin.py
Comment thread word-break/okyungjin.py

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

안녕하세요! 이번 주 리뷰어 김대현입니다.

한 주 동안 고생하셨습니다!! 많이 배워갑니다!

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.

덕분에 find(찾을 문자열, 시작 인덱스)typing.Final을 알아가네요!

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.

두 개의 set()에다가 트리의 구조 정보를 저장하는 방식도 있군요!

구현하신 클래스가 공간 복잡도는 높게 나오지만, 조회 성능이 중요한 문제에서는 좋을 것 같네요!

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 word-break/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.

와우 다양한 방법으로 풀이를 해주셨네요.

trie 자료구조를 사용하는 방법은 저도 문제를 풀면서 잠깐 생각했다가, 안될 것 같아서 다른 방법을 생각했었는데 dp와 함께 풀 수 있었군요! 많이 배워갑니다!

cache 또는 failed, visited, dp로 이미 수행한 결과를 기록하여, 중복 계산을 없애는 방법도 엄청 좋은 것 같네요!

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