Knapsack Problem Leetcode Question