-
-
Notifications
You must be signed in to change notification settings - Fork 195
[yyyyyyyyyKim] WEEK 09 solutions #1520
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
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 = nums[i] | ||
|
||
# 음수*음수는 양수이므로 max,min 둘다 계산 | ||
curr_max = max(n,prev_max*n, prev_min*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.
중간 변수 2개(curr_max, curr_min) 사용하니까 훨씬 이해하기가 편하네요. 👍
# 최소 윈도우 길이 갱신 | ||
if (right - left + 1) < min_len: | ||
min_len = right - left + 1 | ||
answer = s[left:right+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.
최소 윈도우 길이 갱신할 때, answer에 해당 부분 문자열을 바로 저장해두면 마지막에 그대로 반환할 수 있어 편리하네요! 👍
class Solution: | ||
def getSum(self, a: int, b: int) -> int: | ||
|
||
# 비트 연산(보완이 필요함, python은 무제한정수를 사용하므로 mask써서 32bit 정수로 잘라줘야함) |
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.
Python 정수형이 오버플로우 없이 무한정 커질 수 있다는 특징을 알게 되어 좋았습니다.
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!