Question bank › Greedy
Dsa Greedy Medium

Stadium Seating Arrangement

A stadium is designed to accommodate spectators in rows and sections. Each row has a fixed number of seats, and each spectator has a preferred section and a seating capacity they can tolerate. You need to determine the maximum number of spectators that can be seated in the stadium given these preferences while ensuring all spectators are seated with their preferred section limits. Input: The first line contains three integers: `R` (rows), `S` (seats per row), and `N` (number of spectators). The next `N` lines each contain two integers: `P_i` (preferred section) and `C_i` (maximum capacity of spectators). Output: Print a single integer: the maximum number of spectators that can be seated in the stadium. Example: Input: 3 5 6 1 3 2 2 1 1 3 5 2 4 1 2 Output: 8

Key concepts

greedyarraysorting

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.