Skip to content

[Lyla] Week 1 #634

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 7 commits into from
Dec 13, 2024
Merged

[Lyla] Week 1 #634

merged 7 commits into from
Dec 13, 2024

Conversation

lylaminju
Copy link
Contributor

@lylaminju lylaminju commented Dec 4, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@lylaminju lylaminju requested a review from a team as a code owner December 4, 2024 19:25
@github-actions github-actions bot added the py label Dec 4, 2024
@lylaminju lylaminju marked this pull request as draft December 4, 2024 19:28
@lylaminju lylaminju marked this pull request as ready for review December 4, 2024 19:30
@lylaminju
Copy link
Contributor Author

lylaminju commented Dec 4, 2024

Sam 님 도움으로 권한 부여받았습니다!
@DaleSeo 안녕하세요. PR우측에서 Reviewer 및 Projects 설정을 할 수 없는 것 같은데, 혹시 권한 문제가 있는걸까요?
image

@SamTheKorean
Copy link
Contributor

@DaleSeo 안녕하세요. PR우측에서 Reviewer 및 Projects 설정을 할 수 없는 것 같은데, 혹시 권한 문제가 있는걸까요? image

팀 초대가 누락되어있었습니다! 제가 초대드렸으니 초대 수락 후 확인 부탁드립니다!

@lylaminju
Copy link
Contributor Author

@SamTheKorean 초대 수락했습니다! 감사합니다 :)

@lylaminju lylaminju requested a review from mintheon December 4, 2024 20:23
@@ -0,0 +1,3 @@
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
return len(nums) != len(set(nums))
Copy link
Member

Choose a reason for hiding this comment

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

😮 python은 이렇게 set 자료구조를 간편하게 쓸 수 있어 너무 깔끔하게 처리되는군요.

@lylaminju
Copy link
Contributor Author

@SamTheKorean 안녕하세요. 파일명을 깃허브 author 로 해놨는데도 계속 린트 에러가 나는 것 같아요. 혹시 짐작되는 에러 원인이 있을까요?

@obzva
Copy link
Contributor

obzva commented Dec 12, 2024

@pmjuu 안녕하세요
린트에러를 해결하기 위해 작업중이신 브랜치를 main 브랜치에 리베이스 부탁드립니다
참고: https://discord.com/channels/775115965964222492/1229860988170403901/1315689201848680498

Copy link
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

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

1주차 문제를 아주 잘 푸신 것 같습니다! 축하드려요 :)
분잡도 분석 결과를 PR 설명란이 아닌 코드 주석으로 달아주셨으면 리뷰가 좀 더 쉬웠을 것 같습니다. 탭을 왔다리 갔다리 하려니 좀 힘드네요 ㅋㅋ

image

Comment on lines +12 to +14
temp = prev1
prev1 = max(prev2 + num, prev1) # 현재 집을 털었을 때와 안 털었을 때 중 더 큰 이익 선택
prev2 = temp
Copy link
Member

Choose a reason for hiding this comment

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

(안 중요) 요렇게 좀 더 Pythonic 하게 코드를 작성하시면 다른 언어처럼 임시 변수를 안 쓰고 변수의 값을 스왑할 수 있을 것 같아요.

Suggested change
temp = prev1
prev1 = max(prev2 + num, prev1) # 현재 집을 털었을 때와 안 털었을 때 중 더 큰 이익 선택
prev2 = temp
prev1, prev2 = max(prev2 + num, prev1), prev1

Comment on lines +17 to +24
# 빈도가 높은 순서대로 k개의 숫자를 추출
result = []
for freq in range(n, 0, -1):
if buckets[freq]:
result.extend(buckets[freq])

if len(result) == k:
return result
Copy link
Member

Choose a reason for hiding this comment

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

보통 이 문제는 다들 정렬이나 힙을 사용해서 많이 푸시는데, 배열을 사용하셔서 좀 더 효과적으로 해결하셨군요!
result 리스트 안에 원소가 k개가 되자 마자 바로 반환하는 최적화 센스도 너무 좋으세요! 👍
알고리즘 고수의 향기를 맡고 갑니다 🌸

@lylaminju
Copy link
Contributor Author

@DaleSeo 피드백 감사드려요! 다음부터는 시간/공간 복잡도를 주석으로 달아볼게요. 이 방법에 저한테도 더 편할 것 같네요 ㅎㅎ 리뷰 감사합니다~!

@lylaminju lylaminju merged commit 8ed7437 into DaleStudy:main Dec 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

5 participants