macOSCoder/KnapSack.cpp
int netWorth(const vector<int>& knapSack, const vector<Box>& boxes)
{
    int worth = 0;
    for (int idx = 0; idx < knapSack.size(); ++idx)
    {
        int xx = knapSack[idx];
        worth += boxes[xx].value;
    }
    return worth;
}
/*
 * Knapsack problem: maximize the value of boxes in knacksack given a maximum weight constraint.
 * Determine solution when only 1 of each color box can be used.
 * Then determine solution when multiple of each color box can be used.
const char* boxColors[] = {
    "orange", "grey", "blue", "yellow", "green"
};
*/
Knapsack problem: maximize the value of boxes in knacksack given a maximum weight constraint.
Determine solution when only 1 of each color box can be used.
Then determine solution when multiple of each color box can be used.
Knapsack problem : maximize the value of boxes in knacksack given a maximum weight constraint . Determine solution when only 1 of each color box can be used . Then determine solution when multiple of each color box can be used .
int netWorth(const vector<int>& knapSack, const vector<Box>& boxes)
{
    int worth = 0;
    for (int idx = 0; idx < knapSack.size(); ++idx)
    {
        int xx = knapSack[idx];
        worth += boxes[xx].value;
    }
    return worth;
}
int netWorth ( const vector < int > & knapSack , const vector < Box > & boxes ) { int worth = 0 ; for ( int idx = 0 ; idx < knapSack . size ( ) ; ++ idx ) { int xx = knapSack [ idx ] ; worth += boxes [ xx ] . value ; } return worth ; }
Knapsack problem: maximize the value of boxes in knacksack given a maximum weight constraint.
Knapsack problem : maximize the value of boxes in knacksack given a maximum weight constraint .