Code Room
CodingEasycod-g1272
Subject HeapsLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Each server in a fleet reports its current CPU load as an integer. Write a function that returns the k highest load values in descending order, so a dashboard can show the busiest machines first. If k is larger than the number of servers, return every load in descending order; if k is zero or the list is empty, return an empty list. Duplicate loads may appear and each report counts separately. Example: loads = [62, 95, 40, 73], k = 2 gives [95, 73].

Implement
top_server_loads(loads: list[int], k: int) → list[int]
Examples
in[[62,95,40,73],2]out[95,73]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.