⌘K
Flycodx

Canal Water Distribution Schedule

Canal Water Distribution Schedule

HardArrays100% accepted

In Rajasthan, water engineers must schedule releases from N canals over 30 days. Each farmer gets a portion of water from a subarray of consecutive days. Find the schedule where no farmer's portion exceeds their quota and total distribution equals available water.

Approach

Given an array of N daily water levels and M farmer quotas, partition the array into M subarrays such that each subarray sum equals the corresponding quota.

Input

water=[10,5,15,8,12], quotas=[15,20,15]

Output

true
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
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3