• It's a slight variant on subset ...

Question related to mission Loading Cargo

 

It's a slight variant on subset sum, which is NP-complete. Brute force is necessary if we want the exact result.