Question bank › Greedy
Dsa Greedy Medium

Maximize Ring Sizes

You are tasked with resizing a collection of rings to maximize their size within certain constraints, where each ring has an optimal size range. Given the optimal size ranges for the rings, you must assign sizes to each ring such that the total size is maximized but no ring exceeds its optimal size range. Write a function to determine the maximum total size you can assign to the rings. Input: The first line contains an integer `n` (1 ≤ n ≤ 100), the number of rings. The second line contains `n` pairs of integers representing the optimal size ranges as (min, max). Output: Return the maximum total size of the rings. Example: Input: 4 2 5 1 4 3 6 2 3 Output: 18 In this example, you can set sizes to 5, 4, 6, and 3 respectively, achieving a total size of 18.

Key concepts

greedysortingintervals

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.