Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions contains-duplicate/yayyz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:

return len(nums) != len(set(nums))
8 changes: 8 additions & 0 deletions two-sum/yayyz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
hashmap = {}
for i, num in enumerate(nums):
complement = target - num
Copy link
Contributor

Choose a reason for hiding this comment

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

complement라는 변수명을 직관적으로 잘 작성해주신 것 같습니다 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

감사합니다! 최대한 직관적인 변수명으로 작성하려고 했습니다 :)

if complement in hashmap:
return [hashmap[complement], i]
hashmap[num] = i