GhadgeGauri / HactoberFest23

HactoberFest23
https://github.com/GhadgeGauri/HactoberFest23
MIT License
7 stars 35 forks source link

Update Knapsack problem.cpp #51

Open kunaxar opened 1 year ago

kunaxar commented 1 year ago

for (int w = 1; w <= capacity; w++) { The loop should start with w = 0 instead of w = 1. This is because you want to consider the case when the knapsack's capacity is 0, which is a valid scenario.