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
24 changes: 24 additions & 0 deletions contains-duplicate/bskkimm.py
Copy link
Contributor

Choose a reason for hiding this comment

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

문제 풀이 파일들은 commit 시 마지막 줄을 갱신하셔 빈줄을 만들어 주시면 감사하겠습니다!
빈줄이 없으면 CI 진행이 되지 않아요 ㅜ.ㅜ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

문제 풀이 파일들은 commit 시 마지막 줄을 갱신하셔 빈줄을 만들어 주시면 감사하겠습니다! 빈줄이 없으면 CI 진행이 되지 않아요 ㅜ.ㅜ

늦어서 죄송합니다 수정하겠습니다!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

문제 풀이 파일들은 commit 시 마지막 줄을 갱신하셔 빈줄을 만들어 주시면 감사하겠습니다! 빈줄이 없으면 CI 진행이 되지 않아요 ㅜ.ㅜ

image 이렇게 끝내라는 말씀이신거죠??

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from collections import defaultdict
class Solution(object):
def containsDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
# [1,2,3,1]

# [1,1,1,3,3,4,3,2,4,2]

# add element to a dict
# if a same value appears, then return True
# if a for loop ends without disruption, return False

dict = defaultdict(bool)

for num in nums:
if dict[num]:
return True
else:
dict[num] = True

return False
Loading