Pharmacy Batch Expiry Profit Optimization
Pharmacy Batch Expiry Profit Optimization
HardArrays100% accepted
Delhi pharmacy has medicine batches with costs [100, 150, 120] and expiry dates [10, 8, 12]. Daily demand is 2 units/day. Find selling sequence maximizing profit before day 10 cutoff.
Approach
You may sell at most demand batches per day for cutoff days (at most demand*cutoff batches total). Each sold batch yields revenue equal to its cost. Return the maximum total revenue (sell the highest-cost batches first). solve(costs, expiry, demand, cutoff).
Input
costs=[100,150,120], expiry=[10,8,12], demand=2, cutoff=10
Output
370
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