From 0aa94809a5a292b89336b1a83348f447cd65b1f8 Mon Sep 17 00:00:00 2001 From: choiminji Date: Thu, 13 Aug 2026 22:36:21 +0900 Subject: [PATCH] Day15 --- .../1539.py" | 9 ++++++ .../611.py" | 29 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 "leetcode3/\354\265\234\353\257\274\354\247\200/1539.py" create mode 100644 "leetcode3/\354\265\234\353\257\274\354\247\200/611.py" diff --git "a/leetcode3/\354\265\234\353\257\274\354\247\200/1539.py" "b/leetcode3/\354\265\234\353\257\274\354\247\200/1539.py" new file mode 100644 index 00000000..04a33bbc --- /dev/null +++ "b/leetcode3/\354\265\234\353\257\274\354\247\200/1539.py" @@ -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 + \ No newline at end of file diff --git "a/leetcode3/\354\265\234\353\257\274\354\247\200/611.py" "b/leetcode3/\354\265\234\353\257\274\354\247\200/611.py" new file mode 100644 index 00000000..d17f7e93 --- /dev/null +++ "b/leetcode3/\354\265\234\353\257\274\354\247\200/611.py" @@ -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 +