-
-
Notifications
You must be signed in to change notification settings - Fork 195
[DoDo] Week 1 #655
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
[DoDo] Week 1 #655
Conversation
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.
풀이하느라 수고하셨습니다!
주석과 적절한 변수 명명 덕분에 리뷰하기 매우 수월했습니다
시간이 많이 남았으니 시/공간 복잡도에 대한 분석도 같이 남겨주시면 좋겠습니다 :)
// 1. 이전 집까지의 최대 금액 (현재 집 스킵) | ||
// 2. 전전 집까지의 최대 금액 + 현재 집 금액 (현재 집 선택) | ||
for (let i = 2; i < len; i++) { | ||
dp[i] = Math.max(dp[i - 1], dp[i - 2] + nums[i]); |
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.
안녕하세요~ 😊
해당 점화식을 잘 살펴보면 dp
의 i, i-1, i-2
번 요소만 사용하고 있다는 걸 알 수 있습니다
아직 시간이 좀 남았으니 공간 복잡도 최적화에 도전해보시면 어떨까요?
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.