← Questions

Fewest points to pay across reward programs

0
AmazonCodingLast asked May 2026

A coding interview question asked in Amazon's technical phone screen, last asked May 2026. It tests greedy and sorting.

A customer holds points in several reward programs (airline miles, card points, store points). Program i has balance[i] points, each worth value[i] microdollars on the day of purchase. To pay at least target microdollars, choose how many points to spend from each program so the total number of points spent is as small as possible. Points are whole; overpaying is fine. Return that minimum count, or -1 if all the points together can't cover the target.

Interface

Unless you agree on a different interface with the interviewer, assume:

  • min_points(target: int, balance: list[int], value: list[int]) -> int

Example

min_points(168_000_000, [36_000, 12_000, 25_000], [12_000, 9_000, 8_500])  ->  14_000
# 14,000 of the 12,000-microdollar points reach the target exactly
min_points(50, [5, 10], [7, 3])   ->  10     # 5 points of 7 = 35, then 5 points of 3 = 15
min_points(100, [5, 10], [7, 3])  ->  -1     # everything is worth only 65
min_points(0, [5, 10], [7, 3])    ->  0

Constraints

  • 1 to 100 programs; balances are non-negative, values positive.
  • All inputs, products and totals stay below 2^53.

Clarifying questions

  • Is overpaying allowed?
  • Are values fixed for the day of the transaction?
  • Return only the count, or the points per program?
  • Can a program have a minimum redemption?

What a strong answer covers

  • Every point costs the same (one), so spend the most valuable points first; a short exchange argument for why that is optimal.
  • Taking a whole program in one step (or ceil(remaining / value) of it) instead of point by point.
  • O(p log p) for p programs; integer arithmetic only.
  • Tests: zero target, an exact fit, not enough points.

Follow-ups

  • Minimise the dollar value of points used instead of their count, with a fixed set of redemption sizes (now a knapsack).
  • Each program has a minimum redemption or redeems only in blocks of 1,000.
  • Return how many points to take from each program.

Where it's asked

  • Amazon · Technical phone screen · Last asked May 202660 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI

What it tests

greedy · sorting

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding