-
-
Notifications
You must be signed in to change notification settings - Fork 304
[prgmr99] WEEK 02 solutions #2034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@DaleStudy 리뷰해줘 |
|
전체적으로 두 문제 모두 깔끔하고 직관적인 풀이입니다! 특히, 메모이제이션을 활용한 피보나치 접근법과 해시맵을 이용한 아나그램 판별법이 효율적입니다. 다만, 몇 가지 개선 사항과 피드백을 드리자면:
전반적으로 깔끔하고 효율적인 구현입니다! 앞으로도 다양한 방법을 시도하며 최적화하는 연습 계속하세요. 좋은 문제 풀이입니다! |
seungriyou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
풀이가 직관적이어서 이해가 쉬웠습니다! ㅎㅎ
이번 한 주도 수고 많으셨습니다~! 😀
| var climbStairs = function (n) { | ||
| const memo = {}; | ||
|
|
||
| function fibo(num, memo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
클로저 내부에서는 memo에 접근할 수 있으므로 fibo의 파라미터로 memo를 넘길 필요가 없을 것 같습니다!
| return memo[num]; | ||
| } | ||
|
|
||
| const result = fibo(num - 1, memo) + fibo(num - 2, memo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
재귀가 아닌 반복문을 이용한다면 call stack과 memo를 사용할 필요 없이 변수 2개만 사용함으로써 공간 복잡도를 O(1)로 최적화 할 수 있을 것 같아요!
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!