public ArrayList<Integer> solve(int[] weights, int[] values, int knapsackWeight, int numberOfElements) {
    // Values (stored in array values)
    // Weights (stored in array weights)
    // Number of distinct items (numberOfElements)
    // Knapsack capacity (knapsackWeight)
}


This Coding Interview Question is available with an answer in the following programming languages :