Problems > Top K Values > Editorial

Top K Values — Solution & Editorial

Back to the Problem

Sort descending and slice, or maintain a min-heap of size K for O(N log K).

Complexity: O(N log N)