Given two arrays of integers, `supplies` and `demands`, where `supplies[i]` represents the supply at the i-th source and `demands[j]` represents the demand at the j-th sink, determine the maximum total supply that can be allocated to meet the demands while minimizing excess supply.
Explanation: The maximum supply is allocated by providing 10 units from the first warehouse, 20 units from the second warehouse, and 10 units from the third warehouse to meet the demands of 15 and 25 units.
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak