Detailed explanation of the backpack problem