Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[SAM] Week 2 solutions#2418

Merged
SamTheKorean merged 2 commits intoDaleStudy:mainDaleStudy/leetcode-study:mainfrom
SamTheKorean:mainSamTheKorean/leetcode-study_Forked:mainCopy head branch name to clipboard
Mar 14, 2026
Merged

[SAM] Week 2 solutions#2418
SamTheKorean merged 2 commits intoDaleStudy:mainDaleStudy/leetcode-study:mainfrom
SamTheKorean:mainSamTheKorean/leetcode-study_Forked:mainCopy head branch name to clipboard

Conversation

@SamTheKorean
Copy link
Contributor

@SamTheKorean SamTheKorean commented Mar 13, 2026

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@SamTheKorean
Copy link
Contributor Author

@DaleStudy 리뷰해줘

@dalestudy
Copy link
Contributor

dalestudy bot commented Mar 14, 2026

훌륭하게 최적의 동적 프로그래밍 솔루션을 구현하셨네요! 시간 복잡도 TC: O(n), 공간 복잡도 SC: O(1)로 명확하게 분석하셨고, 반복문을 활용한 효율적인 접근법도 잘 적합합니다. 가독성도 좋아지고, 변수 이름도 직관적입니다. 몇 가지 제안 드리자면,

  1. 초기 조건 처리 부분 (if n == 1if n == 2)는 n <= 2로 한 번에 처리하면 조금 더 깔끔할 수 있습니다.
  2. 마지막 return b 대신 return b가 더 명확하며, 현재 구조도 문제없습니다.
  3. 주석에 계산 과정과 시간/공간 복잡도 명확히 표기하셨는데, 이 부분을 함수 설명에 포함시키거나, docstring으로 정리하면 더 좋을 것 같습니다.

이 방법은 이미 최적이기 때문에 더 나은 접근법은 없지만, 가독성과 유지보수성 차원에서 약간의 정리만 더하면 더욱 뛰어난 코드가 될 것 같아요. 계속해서 좋은 문제 풀이 기대하겠습니다!

@juhui-jeong juhui-jeong self-requested a review March 14, 2026 11:27
Copy link
Contributor

@juhui-jeong juhui-jeong left a comment

Choose a reason for hiding this comment

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

파이썬은 확실히 코드가 간결해서 좋네요.
수고하셨습니다! 다음주도 파이팅입니다. 👍

if n == 2 :
return 2

a = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

배열이 아닌 변수를 사용한 공간 최적화. 좋습니다. 👍

a = 1
b = 2

for i in range(n - 2) :
Copy link
Contributor

Choose a reason for hiding this comment

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

변수 i는 현재 코드에서 사용되고 있지 않습니다.
for _ in range(n-2): 로 변경하시면, 의도와 동일하게 동작합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

그 부분을 놓쳤군요! 피드백 감사합니다!

Comment on lines 24 to 37
@@ -16,3 +37,4 @@ def climbStairs(self, n: int) -> int:
a, b = b, result
Copy link
Contributor

Choose a reason for hiding this comment

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

반복문 내부에서 a, b = b, result 형태로 상태를 업데이트하려고 하신 것 맞을까요? 😄
코드 일부만 보여서 전체 로직을 정확히 파악하기가 조금 헷갈립니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이 부분은 2년전 1기때 풀었던 문제라서 문맥이 부족했던 것 같습니다! ㅎㅎ 그 당시에는 말씀하신걸 의도한게 맞습니다! 꼼꼼한 리뷰 감사합니다!

@SamTheKorean SamTheKorean merged commit 59406aa into DaleStudy:main Mar 14, 2026
3 checks passed
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.