Skip to content

Instantly share code, notes, and snippets.

@remiomosowon
Created July 3, 2014 21:36
One-dimensional Knapsack Problem

Problem Statement

There are 5 boxes to be placed into a knapsack. The weights of the boxes are 12kg, 1kg, 4kg, 1kg, and 2kg. Their prices are $4, $2, $10, $1 and $2 respectively.

Which boxes should be chosen to maximise the amount of money while still keeping the overall weight under or equal to 15 kg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment