Question bank › Dynamic Programming
Dsa Dynamic Programming Warm-up

Gift Distribution

In a community event, you have a certain number of gifts that need to be distributed evenly among participants. Each gift has a value associated with it, and you want to maximize the total value each participant receives. Write a program to calculate the maximum total value that can be distributed evenly. Input format: - The first line contains an integer P (1 ≤ P ≤ 50), the number of participants. - The second line contains P space-separated integers representing the values of the gifts. Output format: - A single integer indicating the maximum total value distributed evenly among participants. Example: Input: 4 10 20 30 40 Output: 100

Key concepts

dynamic_programmingdistributioncombinatorics

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.