Skip to content

[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

Merged
merged 6 commits into from
May 31, 2025
Merged

Conversation

yyyyyyyyyKim
Copy link
Contributor

@yyyyyyyyyKim yyyyyyyyyKim commented May 26, 2025

답안 제출 문제

작성자 체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@yyyyyyyyyKim yyyyyyyyyKim self-assigned this May 26, 2025
@yyyyyyyyyKim yyyyyyyyyKim moved this from Solving to In Review in 리트코드 스터디 4기 May 30, 2025
Copy link
Contributor

@Jeehay28 Jeehay28 left a 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)
Copy link
Contributor

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]
Copy link
Contributor

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 정수로 잘라줘야함)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 정수형이 오버플로우 없이 무한정 커질 수 있다는 특징을 알게 되어 좋았습니다.

@yyyyyyyyyKim yyyyyyyyyKim merged commit af8f3cb into DaleStudy:main May 31, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 4기 May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants