Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
8 changes: 8 additions & 0 deletions contains-duplicate/sun912.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
Time complexity: O(n)
"""

class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
nums_set = set(nums)
return len(nums_set) != len(nums)
13 changes: 13 additions & 0 deletions number-of-1-bits/sun912.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
TC: O(log n)
SC: O(1)
"""

class Solution:
def hammingWeight(self, n: int) -> int:
result = 0
while n > 0:
result += n % 2
n = n//2

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.

옷, 파일 마지막에 line break가 빠져있네요.
참고: https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오이잇 감사합니다~=)

Copy link
Contributor

Choose a reason for hiding this comment

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

옷, 파일 마지막에 line break가 빠져있네요. 참고: https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

저는 Python 컨벤션으로 알고 있었는데, 근본의 UNIX 기원이군요 감사합니다