Skip to content

Commit 9c694e9

Browse files
committed
solution: duplicate, two-sum
1 parent 53ce7c7 commit 9c694e9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

contains-duplicate/wozlsla.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def containsDuplicate(self, nums: List[int]) -> bool:
3+
return len(nums) > len(set(nums))

two-sum/wozlsla.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def twoSum(self, nums: List[int], target: int) -> List[int]:
3+
# idx를 따로 저장해두는 게 좋을까? X -> i를 사용하면 될듯
4+
# 만약, 거꾸로 계산한다면?
5+
6+
for i in range(len(nums) - 1):
7+
for j in range(i + 1, len(nums)):
8+
if nums[i] + nums[j] == target:
9+
return [i, j]

0 commit comments

Comments
 (0)