Skip to content

[riveroverflows] WEEK 02 Solutions#2411

Merged
riveroverflows merged 3 commits intoDaleStudy:mainfrom
riveroverflows:main
Mar 15, 2026
Merged

[riveroverflows] WEEK 02 Solutions#2411
riveroverflows merged 3 commits intoDaleStudy:mainfrom
riveroverflows:main

Conversation

@riveroverflows
Copy link
Contributor

@riveroverflows riveroverflows commented Mar 11, 2026

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@riveroverflows
Copy link
Contributor Author

@DaleStudy 리뷰해줘

@dalestudy
Copy link
Contributor

dalestudy bot commented Mar 12, 2026

훌륭하게 깔끔하게 정리된 코드와 상세한 주석이 인상적입니다! 특히 시간복잡도와 공간복잡도를 잘 명시하셨고, 피보나치, 곱셈, 애너그램 문제 각각에 대해 명확한 설명과 적절한 구현이 돋보입니다. 몇 가지 제안드리자면:

  1. 복잡도 분석 명시: 이미 잘 포함되어 있어 매우 좋습니다! 앞으로는 O(1)과 같은 상수 시간도 명시하면 더욱 완벽합니다.

  2. 가독성 향상: for문 내부에서 continue를 사용하는 것보다, 조건문을 if-else 구조로 바꾸면 가독성이 조금 더 좋아질 수 있습니다. 예를 들어, productExceptSelf의 경우 if i == 0: 이후 else로 묶는 것도 고려해보세요.

  3. 최적화 가능성: valid-anagram 문제는 set을 이용하는 현재 방법도 충분히 좋지만, collections.Counter를 활용하면 더 간결하고 효율적입니다. 예를 들어:

    from collections import Counter
    return Counter(s) == Counter(t)

    이렇게 하면 두 문자열의 문자 개수를 비교하는 방식으로 훨씬 직관적이고 성능도 우수합니다.

  4. 일관성 유지: 각 문제별 주석의 포맷이 깔끔하지만, set(s) 이후에 for c in ss:for c in set(s):로 바로 작성하는 것도 좋습니다. 이건 개인 취향이지만, 명확성을 높일 수 있습니다.

전반적으로 매우 잘 작성된 코드입니다! 학습에 도움이 되는 상세한 설명과 구조로, 앞으로도 좋은 방향으로 발전하실 수 있을 것 같아요. 계속해서 연습하시고, 더 간결하고 효율적인 방법도 탐구해보세요!

@riveroverflows
Copy link
Contributor Author

@DaleStudy 승인

Copy link
Contributor

@dalestudy dalestudy bot left a comment

Choose a reason for hiding this comment

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

승인되었습니다! 👍

@heesun-task heesun-task self-requested a review March 13, 2026 16:08
Copy link
Contributor

@heesun-task heesun-task left a comment

Choose a reason for hiding this comment

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

이번 주도 수고 많으셨습니다!

- ss = set(s): 최악의 경우 O(n)
- 그 외 상수: O(1)
- 최종: O(n)
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

👍👍

풀이:
n번째 계단까지 올라가는 방법의 수는 (n-1번째 방법의 수) + (n-2번째 방법의 수).
피보나치수열과 동일한 점화식. memoization으로 중복 계산 방지.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

현재 계단의 방법 수 = 이전 두 계단의 방법 수라서, 전체 배열을 저장하지 않고 직전 두 값만 저장해서 Space complexity를 O(1)으로 만드는 방법도 있다고 합니다
이 방법도 전체적으로 정리도 깔끔하고 좋았습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오 정말 그렇겠네요
생각해보지 못한 방법인데 알려주셔서 감사합니다!!

@riveroverflows riveroverflows merged commit 2534d70 into DaleStudy:main Mar 15, 2026
3 checks passed
@github-project-automation github-project-automation bot moved this from Solving to Completed in 리트코드 스터디 7기 Mar 15, 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.

2 participants