This DP functional equation can be easily solved for j = N, N − 1, . . . , 1
- in this order provided that N and W are not too large. Note that this is
an NP-hard problem and the time complexity of the algorithm based on a
naive implementation of this DP functional equation is O(KW2
) where K :=
k1 + · · · + kn and kj := 1/2wj.