# To find the maximum profit that can be placed in a knapsack of capacity W, when each item must be taken whole or not at all (0/1), using dynamic programming. # Theory # In 0/1 Knapsack, each item is ...
dp[0] = 0; // if there are no steps, we dont have to pay any fee dp[1] = fee[0]; // only one step, so we have to pay its fee // for 2 or 3 steps staircase, since we start from the first step so we ...