GoalScope — knapsack_01 (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
<code>↵ def knapsack_01(weights, values, capacity):↵ """0/1 Knapsack Problem using Dynamic Programming."""↵ n = len(weights)↵ dp = [[0 for _ in range(capacity + 1)] for _ in range(n + 1)]↵ ↵ for i in range(1, n + 1):↵ for w in range(1, capacity + 1):↵ if weights[i-1] <= w:↵ dp[i][w] = max(dp[i-1][w], dp[i-1][w-weights[i-1]] + values[i-1])↵ else:↵ dp[i][w] = dp[i-1][w]↵ ↵ return dp[n][capacity]↵ </code>