Skip to content

[wlghsp] WEEK 01 Solutions - #2921

Merged
wlghsp merged 8 commits into
DaleStudy:mainfrom
wlghsp:week-01
Nov 14, 2026
Merged

wlghsp merged 8 commits into
DaleStudy:mainfrom
wlghsp:week-01

Conversation

@wlghsp

@wlghsp wlghsp commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AI 리뷰(알고리즘 패턴, 시간/공간 복잡도, 학습 현황) 결과는 Checks 탭에서 볼 수 있어요.

@wlghsp wlghsp moved this to In Review in 리트코드 스터디 9기 Nov 13, 2026
@wlghsp wlghsp moved this from In Review to Solving in 리트코드 스터디 9기 Nov 13, 2026
@heesun-task
heesun-task self-requested a review November 13, 2026 05:01
@wlghsp wlghsp moved this from Solving to Completed in 리트코드 스터디 9기 Nov 13, 2026
@wlghsp wlghsp moved this from Completed to In Review in 리트코드 스터디 9기 Nov 13, 2026
class Solution:
def topKFrequent(self, nums: list[int], k: int) -> list[int]:
# 1. 빈도 계산: O(N)
count = Counter(nums)

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.

👍 빈도를 계산해주는 Counter가 있군요. 배워갑니다. 감사합니다!

@wlghsp wlghsp Nov 14, 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.

Counter가 있지만 너무 만들어주는 느낌이라 잘 안 쓸려고 하는데 깔끔해 보여서 썼습니다. 리뷰 감사합니다! 😊


# 2. 빈도를 인덱스로 사용하는 버킷 배열 생성: O(N)
# 최대 빈도는 len(nums)이므로 크기는 len(nums) + 1
buckets = [[] for _ in range(len(nums) + 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.

저도 문제봤을땐 처음푸신 방법 비슷하게 생각했는데 더 효율적인 방법도 있었네요. 참고하겠습니다.
전체적으로 풀이와 파일정리도 모두 깔끔하고 코멘트도 필요한곳에 적절히 주신 것 같습니다. 수고많으셨습니다

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.

처음에는 heap으로 풀이했는데 O(N)으로 가능한 버킷 정렬 풀이가 있길래 한번 학습해보고 있습니다. 리뷰 감사합니다!😊

@wlghsp
wlghsp merged commit 9147cfa into DaleStudy:main Nov 14, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 9기 Nov 14, 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