Skip to content

Commit 87bdeec

Browse files
authored
[minsikpaul92] WEEK 01 Solutions (#2918)
* feat: contains duplicate solution * fix: add trailing newline for linelint * [minsikpaul92] WEEK 01 Solutions * fix: add trailing newline to two-sum solution
1 parent 7cd3d86 commit 87bdeec

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎contains-duplicate/minsikpaul92.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
def containsDuplicate(self, nums: list[int]) -> bool:
3+
seen = set()
4+
for n in nums:
5+
if n in seen:
6+
return True
7+
seen.add(n)
8+
return False

‎two-sum/minsikpaul92.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
def twoSum(self, nums: list[int], target: int) -> list[int]:
3+
for i in range (len(nums)):
4+
for j in range(i+1, len(nums)):
5+
if target == nums[i] + nums[j]:
6+
return [i, j]

0 commit comments

Comments
 (0)