Skip to content

Conversation

hj4645
Copy link
Contributor

@hj4645 hj4645 commented Jul 21, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@hj4645 hj4645 removed the request for review from ohgyulim July 21, 2025 11:54
# Time Complexity
# - set(nums) → O(n)
# - len(nums), len(set(nums)) → O(1)
# - Total: O(n) (n = number of list elements) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

lint error 로 줄바꿈 검사 오류입니다. 마지막 줄 한 줄 추가해주세요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@printjin-gmailcom 안녕하세요
커밋 #f310a52로 개행문자 추가되어 있습니다
감사합니다!

@hj4645 hj4645 requested a review from hyer0705 July 22, 2025 10:06
Copy link
Contributor

@printjin-gmailcom printjin-gmailcom left a comment

Choose a reason for hiding this comment

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

첫 주 수고하셨습니다. 2주차도 화이팅입니다 :)

# 순서가 보장되는 python dictionary를 사용해서,
# 요소 x에 대해서 target-x 가 딕셔너리 내에 있는지를 찾는다.
def twoSum(self, nums: List[int], target: int) -> List[int]:
dict = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

dict는 파이썬 내장 타입이라 변수명으로 사용하면 좋지 않습니다. 참고 부탁드립니다

class Solution:
# nums 에서 가장 빈도가 높은 k개의 요소를 찾는 문제
# 딕셔너리와 정렬을 사용해 해결
# 시간복잡도: O(n log n), 공간복잡도: O(n)
Copy link
Contributor

Choose a reason for hiding this comment

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

heapq나 bucket sort를 쓰면 O(n) 또는 O(n log k)로 더 빠르게 가능합니다. 물론 가독성과 정확성으로는 이 방법이 가장 좋아보이긴 합니다.

Copy link
Contributor

@hyer0705 hyer0705 left a comment

Choose a reason for hiding this comment

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

리뷰가 늦었습니다... 이번 주도 수고하셨습니다!

# 리스트 안에 동일한 숫자가 2개 이상 존재하면 true를 반환해야 하는 문제
# Set으로 변환 시 중복이 제거되므로 List와 Set의 크기를 비교해 답을 구할 수 있음
def containsDuplicate(self, nums: List[int]) -> bool:
return len(nums) != len(set(nums))
Copy link
Contributor

Choose a reason for hiding this comment

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

저도 이런 로직으로 풀이해서 바로 이해가 되었습니다.

@hj4645 hj4645 reopened this Jul 30, 2025
@hj4645 hj4645 merged commit 32d80da into DaleStudy:main Jul 30, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Solving to Completed in 리트코드 스터디 5기 Jul 30, 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.

4 participants