-
-
Notifications
You must be signed in to change notification settings - Fork 304
[youngDaLee] WEEK 03 Solutions #2100
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
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.
이번 한 주도 고생 많으셨습니다!
다만 풀이를 올려주신 문제들일 week03가 아닌 week02 문제들인 것 같아요 ㅠ.ㅠ
| dp[2] = 2 | ||
|
|
||
| for i := 3; i <= n; i++ { | ||
| dp[i] = dp[i-1] + dp[i-2] |
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]를 구할 때마다 dp[i-1]과 dp[i-2]만 필요하므로 O(n) space의 DP 리스트가 아닌 O(1) space의 변수 두 개만 사용함으로써 공간 복잡도를 최적화 할 수 있을 것 같습니다!
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.
오 넵 감사합니다!!
문제 주차 관련해서도 다음 주 부터는 주의하겠습니다 m(_ _)m
| // Calculate right products and combine with left products | ||
| rightProduct := 1 | ||
| for i := n - 1; i >= 0; i-- { | ||
| result[i] *= rightProduct |
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.
변수명도 직관적이고 코드도 깔끔하네요 ><
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!