Knapsack C# implementation task
问题 I'm trying to write knapsack c# algorithm with given conditions but there's always two problems i encountering. I'm getting "Index was outside the bounds of the array" error or my result is just 0. I found couple code examples of Knapsack implementation and just can't figure out what I'm doing wrong. Code examples: https://www.programmingalgorithms.com/algorithm/knapsack-problem http://www.csharpstar.com/csharp-knapsack-problem/ My code: static int Knapsack(int n, int w, int[] s, int[] v) {