Question bank › Two Pointers
Dsa Two Pointers Easy

Balanced Drinks

You have a list of drink volumes and a total volume that must be equally distributed among drinks to meet a balanced ratio. Determine if it's possible to select a continuous subarray of the drink volumes that matches the target volume exactly. Input format: - The first line contains an integer n (1 ≤ n ≤ 1000), the number of drink volumes. - The second line contains n space-separated integers representing the drink volumes. - The third line contains an integer target_volume. Output format: - Output 'Yes' if there exists a continuous subarray of drinks equal to the target volume, otherwise output 'No'. Example: Input: 5 1 2 3 4 5 9 Output: Yes (The subarray is [2, 3, 4])

Key concepts

two_pointersarrayssums

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.