From 35305088b51cdb774c7b630f07defbbbf85c1b04 Mon Sep 17 00:00:00 2001 From: Wdean45 <72251683+Wdean45@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:10:09 +0900 Subject: [PATCH] Update 55-1.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존 K+1번째 값이 아닌 K번째 값이 추출되도록 변경하였습니다. --- 4-non-linear-data-structures/ch15/55-1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/4-non-linear-data-structures/ch15/55-1.py b/4-non-linear-data-structures/ch15/55-1.py index 368262d..aa76708 100644 --- a/4-non-linear-data-structures/ch15/55-1.py +++ b/4-non-linear-data-structures/ch15/55-1.py @@ -8,7 +8,7 @@ def findKthLargest(self, nums: List[int], k: int) -> int: for n in nums: heapq.heappush(heap, -n) - for _ in range(k): + for _ in range(1, k): heapq.heappop(heap) return -heapq.heappop(heap)