-
-
Notifications
You must be signed in to change notification settings - Fork 195
[river20s] WEEK 05 solutions #1391
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
# 최대 이익 갱신 | ||
max_profit = max(max_profit, (price - min_price)) | ||
# 최소 가격 갱신 | ||
min_price = min(min_price, price) |
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.
"최소 이익 갱신 이후 최소 가격 갱신해야 함" 주석이 실제 코드 순서와 반대로 되어 있습니다.
코드에서는 최대 이익을 먼저 계산한 후 최소 가격을 갱신하고 있으므로, 주석과 맞게 조정하면 좋겠습니다 :)
전반적으로 매우 깔끔하고 효율적인 코드 같습니다. 고생하셨습니다👍
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.
감사합니다. 반영하여서 수정했습니다!
리뷰를 반영하여, 최대 이익(max_profit) 계산과 최소 가격(min_price) 갱신 순서를 설명하는 주석이 실제 코드와 반대로 되어 있던 오류를 수정했습니다. 코드에서 사용한 변수명을 주석에 함께 표기해 더 쉽게 읽히도록 했습니다.
- <139. Word Break> 문제에 대한 초기 접근 방식으로 재귀 호출과 트라이를 사용하여 구현함 - 트라이를 통해 딕셔너리 단어 검색 효율은 개선했으나 재귀 호출 과정에서 발생하는 중복 연산 문제로 인해 TLE 발생을 확인하였음 - 메모이제이션 또는 DP로 최적화 예정임 - 문제 이슈: DaleStudy#271
- 기존 재귀 + 트라이 방식에서 발생하던 TLE 문제를 해결하기 위해 메모이제이션을 사용하였음 - `canBreak(start_index)` 함수 결과를 `memo` 딕셔너리에 캐싱하여 동일한 `start_index`에 대한 중복 계산 방지
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!