Question bank › Heap
Dsa Heap Easy

Online Food Delivery

You are managing an online food delivery service. Each order has a time to deliver and a rating (higher is better). Write a program to calculate the maximum average rating of the top k orders that were delivered on time. Input: - The first line contains two integers k and n (the number of orders). - The next n lines contain two integers: delivery time and rating. Output: - A float representing the maximum average rating. Example: Input: 2 3 1 5 2 3 3 4 Output: 4.5

Key concepts

heappriority queuegreedy

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 InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.