Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Stamps Problem

This was a math problem that my third-grade son was given in his math homework. The goal was to figure out the stamps needed to exactly match a certain number of cents. The original problem:

Tim had to mail the following packages:

  1. package 1 cost 42 cents
  2. package 2 cost 76 cents
  3. package 3 cost 94 cents

He had enough 10 cent, 22 cent, and 50 cent stamps to make up the correct amount for each package. What was the least number of stamps he needed to post each package?

See my blog posts at and for a full explanation.

There are three solutions provided here:

  1. - a greedy algorithm that does not always give the correct solution
  2. - compute the correct solution by searching through the product of possible solution members
  3. - much better solution using dynamic programming