Grokking Dynamic Programming Patterns for Coding Interviews
Ask Author
Back to course home

0% completed

0/1 Knapsack

Problem Statement

Given two integer arrays to represent weights and profits of 'N' items, we need to find a subset of these items which will give us maximum profit such that their cumulative weight is not more than a given number 'C'. Write a function that returns the maximum profit. Each item can only be selected once, which means either we put an item in the knapsack or skip it.

Try it yourself

Try solving this question here:


. . .
Mark as Completed