Santa is preparing his sleigh for the holiday season and has a number of gifts with different weights and associated "happiness" values. Due to weight limitations of his sleigh, Santa can only carry gifts up to a certain total weight. Your task is to help Santa determine the maximum total happiness value he can achieve by selecting a subset of gifts without exceeding the weight capacity.
capacity
representing the maximum total weight that can be carried.This problem is a variation of the classic 0/1 Knapsack problem, which can be solved using dynamic programming.
For example, given:
The maximum total happiness value is 7 (by picking the gifts with weight 2 and 3).
Use the starter code for your preferred language to begin your solution.
Happy coding and have a joyful holiday season!