Given a set of items, each with a value and a size, determine the optimal subset of these items to include in a collection of limited capacity, allowing for fractional parts of items to be selected, such that the total value of the selected items is maximized.
Explanation: Calculate value per unit for each item and sort, then select the highest value per unit items until capacity is full, allowing for fractions.
Explanation: Calculate value per unit for each item and sort, then select the highest value per unit items until capacity is full, allowing for fractions.
Maximize value with greedy fraction selection
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak