AMAZON Coding Question – Solved

10 Live
Drone Delivery Optimization – Amazon's Challenge In Amazon's vast distribution network, drones are essential for delivering packages. These drones have varying capacities, ranging from 1 to 10⁹. Each j-th drone has a carrying capacity of j. Problem Statement Amazon needs to dispatch n packages, where the weight of the i-th package is given by the array pack[i].During peak delivery times, only two drones are available for transport. These drones must alternate in their duties. This means: - If Drone 1 delivers the i-th package, - Then Drone 2 must deliver the (i+1)-th package, and so on. However, not all drones can carry all packages β€” some packages might be too heavy for a particular drone. To address this issue, Amazon can replace certain packages with others of a different (lighter) weight to ensure successful delivery. Task Your task is to determine the minimum number of package replacements needed, such that all packages can be successfully delivered by some pair of drones, alternating turns. You are allowed to choose any two drones with any capacity. Example n = 4 pack = [3, 1, 3, 2]

Asked in: AMAZON

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| The supply chain manager at one of Amazon's warehouses is shipping the last con… |
| Determine the highest value after executing n steps on an infinite 2D grid that… |
| Amazon Prime Video is developing a new feature called "Segmentify." This featur… |
| In this new stock prediction game launched on Amazon Games, Player 1 provides P… |
| Amazon operates numerous warehouses, with each warehouse holding inventory[i] u… |
| In Amazon's highly efficient logistics network, minimizing operational overhead… |