Dynamic Programming – Minimum cost to fill given weight in a bag
We are given an array of positive weights cost where cost[i]
represents the cost of filling i + 1
kg’s of oranges in a bag (0-based indexing). We need to find the minimum cost to buy exactly w
kg’s of oranges assuming infinite supply of each i + 1
kg’s of oranges.