🎁 Exclusive Offer! Join our Telegram Channel to get **special discounts** and updates! 🚀

🚀 Struggling with coding interviews? We've got you covered! 💡 Practice real questions, sharpen your skills, and land your dream job! 🎯
Question 73 - 100% Working Solution | Buy Now

Description

4 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