Skip to content

[i-mprovising] Week 01 solutions #1167

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
Apr 5, 2025
Merged

Conversation

i-mprovising
Copy link
Contributor

@i-mprovising i-mprovising commented Apr 1, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@github-actions github-actions bot added the py label Apr 1, 2025
@i-mprovising i-mprovising moved this from Solving to In Review in 리트코드 스터디 4기 Apr 1, 2025
@i-mprovising i-mprovising moved this from In Review to Solving in 리트코드 스터디 4기 Apr 1, 2025
@i-mprovising i-mprovising moved this from Solving to In Review in 리트코드 스터디 4기 Apr 1, 2025
@i-mprovising i-mprovising moved this from In Review to Solving in 리트코드 스터디 4기 Apr 2, 2025
@hsskey hsskey self-requested a review April 4, 2025 13:55
nums_set = set(nums)
if len(nums) == len(nums_set):
return False
return True
Copy link
Member

Choose a reason for hiding this comment

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

Set을 이용해서 중복을 없앤뒤 기존 배열과 비교해서 처리한 부분이 저랑 비슷한 풀이같네요👍

@hsskey
Copy link
Member

hsskey commented Apr 5, 2025

@i-mprovising
아직 solving 상태이긴하나, 토요일 전까지 PR을 병합이 되야하는 관계로 먼저 올라온 내용에 대해 리뷰 시작했습니다.
확인해보니 1주차별 문제풀이와 File Changed에 나오는 문제가 조금 다른거같은데 확인 부탁드립니다.
문제 풀이 스케줄 (view)

@i-mprovising i-mprovising moved this from Solving to In Review in 리트코드 스터디 4기 Apr 5, 2025
@i-mprovising
Copy link
Contributor Author

@i-mprovising 아직 solving 상태이긴하나, 토요일 전까지 PR을 병합이 되야하는 관계로 먼저 올라온 내용에 대해 리뷰 시작했습니다. 확인해보니 1주차별 문제풀이와 File Changed에 나오는 문제가 조금 다른거같은데 확인 부탁드립니다. 문제 풀이 스케줄 (view)

넵 확인 감사합니다!
처음에 주차별로 문제가 정해져 있는지 모르고 풀었는데, 주차별 문제 확인 후 다시 풀이 올렸습니다.

for i, x in enumerate(nums):
y = target - x
if (y in table) and table[y] != i:
return [i, table[y]]
Copy link
Member

@hsskey hsskey Apr 5, 2025

Choose a reason for hiding this comment

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

첫 번째 루프에서 table을 미리 만드는 것보다는, enumerate로 순회하면서 동시에 dict에 저장해서
개선해 볼 수 있을거같아
의견 남깁니다.

ex)

table = {}
        for i, num in enumerate(nums):
            complement = target - num
            if complement in table:
                return [table[complement], i]
            table[num] = i

Copy link
Contributor Author

Choose a reason for hiding this comment

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

상세한 리뷰 감사합니다!
굳이 루프를 더 쓸 필요가 없네요.

@hsskey
Copy link
Member

hsskey commented Apr 5, 2025

@i-mprovising 확인 완료하였습니다.
잘못올라간 문제들은 삭제하고, 해당주차 풀이 때 다시 올리면 될거같습니다.

@i-mprovising i-mprovising merged commit a65d714 into DaleStudy:main Apr 5, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 4기 Apr 5, 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