Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions leetcode3/최민지/1539.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Solution:
def findKthPositive(self, arr: List[int], k: int) -> int:
count = 0
for i in range(1,1001):
if i not in arr:
count += 1
if count == k:
return i

29 changes: 29 additions & 0 deletions leetcode3/최민지/611.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class Solution:
def triangleNumber(self, nums: List[int]) -> int:
nums.sort()
# 삼각형 조건: a + b > c

count = 0
for i in range(len(nums)-1, -1, -1):
c = nums[i]

left = 0
right = i-1

while left < right:
if nums[left] + nums[right] > c:
count += right - left
right -= 1
else:
left += 1

#for j in range(i-1, -1, -1):
# b = nums[j]
# for k in range(j-1,-1, -1):
# a = nums[k]

# if a + b > c:
# count += 1

return count