Minimize Points Used Across Multiple Reward Programs
Company: Amazon
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Overview: Minimize the number of indivisible reward points needed to meet or exceed a microdollar target across programs with different values and finite balances, returning failure when coverage is impossible.
Read the full Amazon Software Engineer interview experience this question came from
Constraints
- 1 <= len(balance) = len(value) <= 100.
- The target and balances are nonnegative integers, and point values are positive integers.
- Each program's balance is a hard upper bound and points are indivisible.
- All inputs, products, totals, and answers stay within 2^53; use signed 64-bit integers in Java and C++.
Examples
Input: (168000000, [36000, 12000, 25000], [12000, 9000, 8500])
Expected Output: 14000
Explanation: This is the source example; 14,000 points at the highest value exactly reach the target.
Input: (0, [5, 10], [7, 3])
Expected Output: 0
Explanation: A zero target needs no points.
Hints
- Since every selected point costs one in the objective, compare programs by value per point.
- Consume higher-value points in bounded groups and report -1 if value remains uncovered after all groups.