Quadratic Knapsack Problem Leetcode