2 parents 7222a8f + 0aa9480 commit 7e04294Copy full SHA for 7e04294
2 files changed
leetcode3/최민지/1539.py
@@ -0,0 +1,9 @@
1
+class Solution:
2
+ def findKthPositive(self, arr: List[int], k: int) -> int:
3
+ count = 0
4
+ for i in range(1,1001):
5
+ if i not in arr:
6
+ count += 1
7
+ if count == k:
8
+ return i
9
+
leetcode3/최민지/611.py
@@ -0,0 +1,29 @@
+ def triangleNumber(self, nums: List[int]) -> int:
+ nums.sort()
+ # 삼각형 조건: a + b > c
+ for i in range(len(nums)-1, -1, -1):
+ c = nums[i]
10
+ left = 0
11
+ right = i-1
12
13
+ while left < right:
14
+ if nums[left] + nums[right] > c:
15
+ count += right - left
16
+ right -= 1
17
+ else:
18
+ left += 1
19
20
+ #for j in range(i-1, -1, -1):
21
+ # b = nums[j]
22
+ # for k in range(j-1,-1, -1):
23
+ # a = nums[k]
24
25
+ # if a + b > c:
26
+ # count += 1
27
28
+ return count
29
0 commit comments