Skip to main content

knapsack_01

Function knapsack_01 

Source
pub fn knapsack_01(
    weights: &[i64],
    values: &[i64],
    capacity: i64,
) -> Result<i64, Error>
Expand description

0/1 knapsack.

capacity and every weight must be non-negative and fit in usize (on 32-bit platforms values above u32::MAX are rejected instead of silently truncated).