-
-
Notifications
You must be signed in to change notification settings - Fork 195
[SAM] Week 10 solutions #162
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
house-robber/samthekorean.py
Outdated
@@ -0,0 +1,19 @@ | |||
# TC : O(n) | |||
# SC : O(1) |
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 라는 array를 만들기 때문에 O(n) 이 되어야 할 것 같습니다.
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.
아 실수했군요! 피드백 감사합니다!
@WhiteHyun 님, 이 PR에 대한 코드 리뷰를 좀 부탁드려도 될까요? (관련 가이드 참고) |
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.
고생하셨습니다 :)
(리뷰가 늦어서 죄송합니다)
if n == 1: | ||
return nums[0] | ||
if n == 2: | ||
return max(nums[0], nums[1]) | ||
if n == 3: | ||
return max(nums[0], max(nums[1], nums[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.
이 부분은 n <= 3
일 때 max(nums)
로 해결할 수 있을 것 같아보여요. :)
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.
그렇게 하면 더 간결하겠군요! 피드백 감사합니다!
No description provided.