Microsoft SDE Intern Interview Experience
💼 LTIMindtree Interview Experience (On-Campus) | Fresher | 2026
Salesforce SMTS | Interview Experience | Rejected
JPMC | SDE2 (Associate) - Java Backend - Interview Experience + Compensation
Microsoft - SDE2 - Coding Round
Amazon Online Assessment!
Summary
This post describes a coding problem encountered during an Amazon Online Assessment, focusing on optimizing package delivery using drones with varying capacities and minimizing package replacements.
Full Experience
In ABC's distribution network, there are several drones with varying capacities, ranging from 1 to 10^9. Each ith drone has a carrying capacity of j. The company needs to dispatch n packages, where the weight of the ith package is given by pack[i].
During peak delivery times, only two drones are available to transport the packages, and they must alternate in their duties. This means that if Drone 1 handles the ith package, Drone 2 must handle the (i + 1)th package, and so on.
However, there may be challenges if the drones cannot handle certain package weights (i.e., some packages may be too heavy for a drone). To address this, Amazon can replace certain packages with others of a different weight to ensure that all packages are successfully delivered.
Given the ability to choose any two drones, your task is to determine the minimum number of replacements needed to ensure that all packages can be successfully delivered.
Example 1: n=4 pack=[3,1,3,2] Ans=1
Example 2: n=4 pack=[1,1,1,1] Ans=2
Interview Questions (1)
In ABC's distribution network, there are several drones with varying capacities, ranging from 1 to 10^9. Each ith drone has a carrying capacity of j. The company needs to dispatch n packages, where the weight of the ith package is given by pack[i].
During peak delivery times, only two drones are available to transport the packages, and they must alternate in their duties. This means that if Drone 1 handles the ith package, Drone 2 must handle the (i + 1)th package, and so on.
However, there may be challenges if the drones cannot handle certain package weights (i.e., some packages may be too heavy for a drone). To address this, Amazon can replace certain packages with others of a different weight to ensure that all packages are successfully delivered.
Given the ability to choose any two drones, your task is to determine the minimum number of replacements needed to ensure that all packages can be successfully delivered.
Example 1: n=4 pack=[3,1,3,2] Ans=1
Example 2: n=4 pack=[1,1,1,1] Ans=2