Search⌘ K

Feature #7: Optimize Delivery Cost

Explore how to optimize Amazon's delivery costs by determining if adjacent packages can be grouped to fully utilize shipping truck weight increments. This lesson guides you through using cumulative sums and the remainder theorem to solve real-world logistics problems efficiently in coding interviews.

Description

In addition to other important tasks, Amazon’s logistic division is responsible for delivering packages. They have partnered with many delivery services so that the orders can reach customers quickly. One of the carrier companies has pricing criteria; we want to use that criteria to our advantage so that we can deliver maximum packages at minimum cost. This carrier is willing to send one or more trucks for deliveries as needed, but they charge in increments of kk lbs. The vendor has different size truck (in increments of kk lbs) available. Anything below kk lbs costs $10. Whereas, anything between kk and 2k2k lbs costs $20 and so on. If we ship anything less than ...