Get Minimum Cost
Problem Overview
- Find the minimum total cost to buy exactly m items from n types; the j-th item of type i costs a[i] + (j-1)*b[i].
- Input: arrays a[n], b[n] and integer m. Output: a long integer minimum cost.
- Context: Amazon Go Store pricing with infinite stock per type and increasing unit cost.
- Constraints: 1≤n,m≤1e5; 1≤a[i],b[i]≤1e5.
- Amazon coding interview problem; a common interview question from Amazon interviews.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
