Skip to content

Conversation

@deepInTheWoodz
Copy link
Contributor

@deepInTheWoodz deepInTheWoodz commented Nov 14, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

Copy link
Contributor

@hyunolike hyunolike left a comment

Choose a reason for hiding this comment

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

👍

@TonyKim9401
Copy link
Contributor

@DaleStudy

@dalestudy
Copy link
Contributor

dalestudy bot commented Nov 16, 2025

우선, 여러 문제에 대한 깔끔한 해결책을 제출해 주셔서 감사드려요! 전반적으로 가독성이 좋고 효율적인 접근법들이 많아 인상적입니다. 몇 가지 개선점과 피드백을 드리자면:

  1. 시간/공간 복잡도 명시
    모든 함수에 시간과 공간 복잡도를 명확히 표기하는 습관을 추천드립니다. 예를 들어, containsDuplicateTC: O(n), SC: O(n)이고, topKFrequentTC: O(n log n), SC: O(n) 정도입니다. 이렇게 표기하면 리뷰어가 이해하기 쉬워지고, 본인도 효율성을 다시 한 번 점검하는 데 도움이 됩니다.

  2. topKFrequent의 정렬 방법 개선
    현재는 sorted 함수를 사용해 빈도별로 정렬 후, 마지막 k개를 슬라이싱하는 방식입니다. 이는 O(n log n) 시간 복잡도를 갖고 있는데, heapq 모듈의 nlargest를 활용하면 더 효율적(O(n log k))입니다. 참고로, 이 방식은 대용량 데이터셋에서 더욱 유리합니다.

  3. 가독성 및 스타일

  • counter 대신 collections.Counter를 사용하면 더 간결하고 명확합니다.
  • if-else 대신 counter[num] = counter.get(num, 0) + 1 같은 딕셔너리의 get을 활용하는 것도 간결성을 높일 수 있습니다.
  1. twoSum의 구현
    현재 구현은 깔끔하고 효율적입니다. 딕셔너리로 조회하는 방식이 O(n) 시간으로 최적입니다. 다만, List[int] 타입 힌트가 빠졌으니 추가하는 것도 좋겠어요.

전체적으로, 좋은 방향성을 유지하면서 약간의 최적화와 명확성 표기를 더한다면 더욱 뛰어난 코드가 될 것 같습니다. 계속해서 좋은 문제 해결 기대할게요!

Copy link
Contributor

@TonyKim9401 TonyKim9401 left a comment

Choose a reason for hiding this comment

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

1주차 문제 풀이 고생하셨습니다!
온보딩 및 스터디 적응 하시는데 앞으로 조금 더 힘내주시고 앞으로의 15주간 여정 응원합니다.
2주차 문제 풀이도 파이팅입니다!

counter[num] = 1

return [num[0] for num in sorted(counter.items(), key=lambda x: x[1])[-k:]]

No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

첫 주 고생 많으셨습니다 🚀 추가로, 정상적인 병합을 위해 파일의 마지막에 개행 문자를 추가해주시면 감사드리겠습니다!

@TonyKim9401 TonyKim9401 added this pull request to the merge queue Nov 17, 2025
Merged via the queue into DaleStudy:main with commit fce3f30 Nov 17, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Solving to Completed in 리트코드 스터디 6기 Nov 17, 2025
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.

4 participants