Reward Top K Students
A medium-tier problem at 46% community acceptance, tagged with Array, Hash Table, String. Reported in interviews at Booking.com and 0 others.
Reward Top K Students is a medium-difficulty problem that shows up in real assessments at companies like Booking.com. You're given student data and need to surface the top K performers by some metric, which sounds simple until you realize the sorting criteria or data structure isn't obvious from the problem statement. The trap is trying to brute-force a full sort when you should be using a heap or partial sort. Acceptance rate sits at 46 percent, meaning nearly half the candidates who attempt it walk away empty-handed. If this problem hits your live OA and you blank on whether to use a min-heap or custom comparator, StealthCoder solves it in seconds, invisible to the proctor.
Companies that ask "Reward Top K Students"
Reward Top K Students is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.
Get StealthCoderThe core trick is recognizing when a full sort is wasteful and a heap buy you O(N log K) instead of O(N log N). You'll parse student records into a hash table or object map, extract scores or rewards, then identify the top K performers. The gotcha is usually in the tiebreaker logic or the output format. Some versions ask for sorted order within the top K, which means you can't just dump the heap. Others have weird comparison rules based on string lexicography or multiple numeric fields. Common failure: sorting the entire input, then taking the first K. Better approach: use a min-heap of size K and iterate once, or use quickselect if the language supports it. Array, String, and Sorting topics confirm you're dealing with mixed data types and comparison logic. The Hash Table accelerates lookups; the Heap or Priority Queue is your scaling advantage. When you're stuck on the exact comparator or the output format during the real assessment, StealthCoder runs invisible during screen share and surfaces the working solution.
Pattern tags
You know the problem.
Make sure you actually pass it.
Reward Top K Students recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Reward Top K Students interview FAQ
Is this problem still asked at real companies?+
Yes. Booking.com has reported asking it. The acceptance rate of 46 percent suggests it's not a rare or ancient problem. It's asked often enough that prep guides still include it, but the 46 percent pass rate means most candidates don't nail it on first try. It's not a gimmick problem.
What's the core trick I'm missing if I time out?+
You're probably sorting the entire input. Use a min-heap of size K instead. Iterate through students once, push to the heap, pop the smallest when heap size exceeds K. This gives you O(N log K) instead of O(N log N). For smaller datasets a full sort works, but the efficient solution is always heap-based.
How do Array, Hash Table, and Sorting all relate to this problem?+
Array is your input format. Hash Table (or a dictionary/map) speeds up lookups and aggregation of student data. Sorting either happens on the full dataset (inefficient) or implicitly within a heap (efficient). The topics tell you: structured input, fast lookups, and ranking logic all matter here.
Should I sort the final K results before returning?+
Check the expected output format in the problem statement. If the top K must be in descending order or alphabetical order by name, a final sort on K elements (very cheap) is necessary. If the problem doesn't specify order, heap order is fine. This detail trips candidates up because they extract the top K correctly but fail the output format.
What language features make this easier?+
Python's heapq module and custom comparators are solid. Java's PriorityQueue with a custom Comparator works well. C++ has priority_queue. The language doesn't matter as much as knowing when to apply heap vs. sort. Libraries handle the mechanics; your job is pattern recognition on the problem statement.
Want the actual problem statement? View "Reward Top K Students" on LeetCode →