Canal Water Distribution Round-Robin
Canal Water Distribution Round-Robin
MediumArrays5% accepted
The irrigation department in Uttar Pradesh manages a canal serving 5 villages with daily water capacity of 100 units. Villages need [20, 25, 15, 18, 22] units respectively. Find how many villages can be fully served each day in rotation.
Approach
Given daily water capacity and array of village water requirements, find the maximum number of consecutive villages that can be fully served starting from index 0.
Input
capacity=100, requirements=[20, 25, 15, 18, 22]
Output
5
More Arrays problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards