nlargest1 [LEET CODE] 215. Kth Largest Element in an Array # Problem Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Constraints: 1 int: return sorted(nums, reverse=True)[k - 1] # 힙 ( heap ) 최소힙 - 부모가 항상 자식보다 작거나 같다 ( 좌우 트리는 정렬된 구조는 아님) 최대힙 - 부모가 항상 자식보다 크거나 같다 거의 완전한 트리인 특수한 트리 기반 자료구조 우선순위 큐 구현 2021. 5. 26. 이전 1 다음 반응형