Question bank › Heap
Dsa Heap Medium

Find Top N Scores

You are given a list of scores achieved by players in a game and need to find the top N unique scores. Your program should sort these scores in descending order and output them. Input format: - The first line contains two integers: m (the number of scores, 1 <= m <= 1000) and n (the top N scores to return, 1 <= n <= m). - The second line contains m scores, each between 1 and 100. Output format: - Output the top N scores separated by spaces in descending order. Example: Input: 5 3 100 90 90 80 70 Output: 100 90 80

Key concepts

heapsortingscores

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.