[liza0525] WEEK 02 solutions#2417
Merged
liza0525 merged 5 commits intoDaleStudy:mainfrom Mar 13, 2026
Merged
Conversation
| class Solution: | ||
| # 해당 문제는 이전 계단까지 계산된 경우의 수를 찾아가며 현재 계단까지 오를 수 있는 경우의 수를 계산한다. | ||
| # n번째 계단까지 오를 수 있는 경우의 수는 (n-1번째까지 오를 수 있는 경우의 수) + (n-2번째까지 오를 수 있는 경우의 수)이다. | ||
| # 이는 동적 프로그래밍을 이용해 memoization을 하며 풀 수 있는 문제라고 할 수 있다. |
Contributor
There was a problem hiding this comment.
덕분에 memoization에 대해서도 리뷰했습니다!
| return memo[n] | ||
|
|
||
| # (n번째까지 오를 수 있는 경우의 수) = (n-1번째까지 오를 수 있는 경우의 수) + (n-2번째까지 오를 수 있는 경우의 수) | ||
| memo[n] = dfs(n - 1) + dfs(n - 2) |
Contributor
There was a problem hiding this comment.
저는 a,b,c로 지정해서 풀었는데 이렇게 함수로 만들어서 푸니까 더 직관적이네요!
Contributor
Author
There was a problem hiding this comment.
우와 어떻게 푸셨는지 궁금해서 구경하고 왔는데, 제겐 새로운 풀이 방법이었습니다!
결국 피보나치 수열 문제던데, 변수로도 충분히 풀 수 있다는 점이 정말 새로웠어요 👀✨
공간복잡도가 O(1)이 될 수도 있다는 점에서 감탄하구 왔씁니다!
SamTheKorean
approved these changes
Mar 13, 2026
Contributor
SamTheKorean
left a comment
There was a problem hiding this comment.
모든 문제를 다 푸셨다니 고생많으셨습니다!. 리뷰하면서 정석적으로 푸신다는 느낌을 받아서 잊어버렸던 개념들에 대해서 리마인드하는 시간이 되었습니다!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!