Search⌘ K

Feature #7: Optimize Delivery Cost

Explore how to optimize delivery costs by grouping adjacent packages to fully utilize carrier pricing increments. Understand using cumulative sums and remainders to find optimal package combinations in a JavaScript coding scenario.

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 ...