Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions contains-duplicate/hj4645.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Solution:
# 리스트 안에 동일한 숫자가 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.

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


# Time Complexity
# - set(nums) → O(n)
# - len(nums), len(set(nums)) → O(1)
# - Total: O(n) (n = number of list elements)
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로 개행문자 추가되어 있습니다
감사합니다!

Loading