Dsa
Greedy
Warm-up
Minimum Snacks Distribution
You are organizing a party and have a limited supply of different types of snacks. You want to distribute them to your guests in such a way that each guest receives the same proportion of snacks from each type available. Given an array of integers where each element represents the number of snacks of a particular type available, calculate the maximum number of guests that can receive the snacks evenly. Each guest should receive 1 from each type until the supply runs out.
Input Format:
- The first line contains an integer n, the number of snack types.
- The second line contains n space-separated integers representing the number of each type of snack.
Output Format:
- An integer representing the maximum number of guests that can be served the snacks evenly.
Example:
Input:
4
12 6 9 3
Output:
3
Key concepts
greedysortingarray
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