Skip to content

[liza0525] WEEK 02 solutions#2417

Merged
liza0525 merged 5 commits intoDaleStudy:mainfrom
liza0525:main
Mar 13, 2026
Merged

[liza0525] WEEK 02 solutions#2417
liza0525 merged 5 commits intoDaleStudy:mainfrom
liza0525:main

Conversation

@liza0525
Copy link
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

class Solution:
# 해당 문제는 이전 계단까지 계산된 경우의 수를 찾아가며 현재 계단까지 오를 수 있는 경우의 수를 계산한다.
# 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.

덕분에 memoization에 대해서도 리뷰했습니다!

return memo[n]

# (n번째까지 오를 수 있는 경우의 수) = (n-1번째까지 오를 수 있는 경우의 수) + (n-2번째까지 오를 수 있는 경우의 수)
memo[n] = dfs(n - 1) + dfs(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.

저는 a,b,c로 지정해서 풀었는데 이렇게 함수로 만들어서 푸니까 더 직관적이네요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

우와 어떻게 푸셨는지 궁금해서 구경하고 왔는데, 제겐 새로운 풀이 방법이었습니다!
결국 피보나치 수열 문제던데, 변수로도 충분히 풀 수 있다는 점이 정말 새로웠어요 👀✨
공간복잡도가 O(1)이 될 수도 있다는 점에서 감탄하구 왔씁니다!

Copy link
Contributor

@SamTheKorean SamTheKorean left a comment

Choose a reason for hiding this comment

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

모든 문제를 다 푸셨다니 고생많으셨습니다!. 리뷰하면서 정석적으로 푸신다는 느낌을 받아서 잊어버렸던 개념들에 대해서 리마인드하는 시간이 되었습니다!

@liza0525 liza0525 merged commit 6e1a139 into DaleStudy:main Mar 13, 2026
3 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 7기 Mar 13, 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