Knapsack problem - variant - O(C) solution


Another variant that’s driving me crazy (I’d love to see the answers to the variants in a future edition!) is the O© solution for the Knapsack problem. I’ve tried using hashtables where I hash the weight remaining, and I’ve tried where I hash the current weight of the knapsack, but neither work.