input: Write a python function to solve the knapsack problem using dynamic programming.
  assert knapsack(5, 8, [2, 3, 4, 5, 6], [2, 5, 6, 12, 9]) == 20
  assert knapsack(4, 7, [1, 3, 4, 5], [1, 4, 5, 7]) == 9
  assert knapsack(3, 50, [10, 20, 30], [60, 100, 120]) == 220
output: def knapsack(n, W, wt, val):
      dp = [[0 for _ in range(W + 1)] for _ in range(n + 1)]
  
      for i in range(1, n + 1):
          for w in range(1, W + 1):
              if wt[i - 1] <= w:
                  dp[i][w] = max(dp[i - 1][w], dp[i - 1][w - wt[i - 1]] + val[i - 1])
              else:
                  dp[i][w] = dp[i - 1][w]
  
      return dp[n][W]