Complete-Preparation

🎉 One-stop destination for all your technical interview Preparation 🎉

View the Project on GitHub

Rod cutting 🌟🌟

Solution

Code

int cutRod(vector<int> &price, int n)
{
    vector<int> len(n,0);
    for (int i = 0; i < n; i++)
        len[i] = i + 1;
    int maxLen = n;
	return unboundedKnapsack(n, maxLen, price, len);
}