Knapsack Problem solution with repetition of items

0-1 knapsack with repetition of items allowed. Time Complexity: O(W*n) Space complexity: O(W)