Skip to content

[jylee2033] WEEK 05 solutions#2503

Merged
jylee2033 merged 8 commits intoDaleStudy:mainfrom
jylee2033:main
Apr 5, 2026
Merged

[jylee2033] WEEK 05 solutions#2503
jylee2033 merged 8 commits intoDaleStudy:mainfrom
jylee2033:main

Conversation

@jylee2033
Copy link
Copy Markdown
Contributor

@jylee2033 jylee2033 commented Apr 3, 2026

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@jylee2033 jylee2033 moved this from Solving to In Review in 리트코드 스터디 7기 Apr 3, 2026
@Hyeri1ee Hyeri1ee self-requested a review April 4, 2026 03:07
Copy link
Copy Markdown
Contributor

@Hyeri1ee Hyeri1ee left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~


# Iterate through prices
for i, price in enumerate(prices):
if price < buy:
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) 으로 푸신것 같습니다! 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.

말씀해 주신 내용 반영해서 O(n)으로 개선해서 다시 풀어봤어요! 피드백 감사합니다 😊

def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
anagram_map = {}
for word in strs:
key = "".join(sorted(word))
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한 키에 대해 단어를 추가하는 로직으로 깔끔하게 잘 짜신 것 같습니다!

@jylee2033 jylee2033 closed this Apr 4, 2026
@jylee2033 jylee2033 reopened this Apr 4, 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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Greedy
  • 설명: 이 코드는 매번 최적의 선택(최저 구매가와 최대 이익)을 하는 그리디 알고리즘을 사용하여 최대 수익을 계산합니다.

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set, Sorting
  • 설명: 이 코드는 문자열을 정렬하여 그룹화하는데 해시 맵을 사용하며, 정렬이 핵심입니다. 정렬된 문자열을 키로 하여 anagram 그룹을 구분합니다.

@jylee2033 jylee2033 merged commit 7a067f7 into DaleStudy:main Apr 5, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 7기 Apr 5, 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