# Challenge: Maximum Value of the Loot

Solve the Maximizing the Value of the Loot Problem.

## We'll cover the following

## Problem

**Maximizing the Value of the Loot Problem**

Find the maximal value of items that fit into the backpack.

**Input:** The capacity of a backpack $W$, as well as the weights $(w_{1}
,\ldots,w_{n})$ and costs $(c_{1},\ldots, c_{n})$ of $n$ different compounds.

**Output:** The maximum total value of fractions of items that fit into the backpack of the given capacity, i.e., the maximum value of
$c_{1}·f_{1}+\ldots+c_{n}·f_{n}$ such that $w_{1}·f_{1}+\ldots+w_{n}$·$f_{n} ≤ W$ and $0 ≤ f_{i} ≤ 1$ for all $i$ ($f_{i}$
is the fraction of the $i$-th item taken to the backpack).

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.