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 ( OA ) June 2025
Summary
Recently took Amazon's Online Assessment in June 2025 and shared one of the questions encountered. The other question was a well-known problem about subarrays with GCD > 1. This post focuses on the Warehouse Dispatch Optimization problem.
Full Experience
Recently took Amazon’s Online Assessment in June 2025, and wanted to share one of the questions I encountered that I haven't seen much discussion around.
The other question was the well-known Minimizing Vulnerability Factor; the one with subarrays having GCD > 1. That’s already been discussed here a lot.
## Warehouse Dispatch Optimization
Amazon operates numerous warehouses, with each warehouse i holding inventory[i] units of a particular product. You and your co-worker are responsible for dispatching these items to fulfill customer orders, following a specific process.
(1) When dispatching from warehouse i, you begin by reducing the inventory of the ith warehouse by dispatch1 units.
(2) After your dispatch, your co-worker reduces the inventory by dispatch2 units.
(3) This process repeats until the inventory of the ith warehouse reaches zero or becomes negative (i.e., inventory[i]
(4) For every warehouse that is emptied during your dispatch, you and your co-worker collectively earn 1 credit.
Your co-worker has the option to skip their turn, but they can only do this limited number of times, defined by skips.
Your task is to determine the best strategy to maximize the total credits that both you and your co-worker can earn together.
---
You are responsible for dispatching inventory from n warehouses. Each warehouse has a certain number of units. The dispatch process alternates turns between you and your co-worker as follows:
Your Turn: You dispatch dispatch1 units.
Co-worker's Turn: They dispatch dispatch2 units.
Steps 1 and 2 repeat until the inventory of that warehouse becomes less than or equal to zero.
You earn 1 credit if you are the one who reduces the inventory to zero or less, i.e., if the warehouse is emptied on your turn.
Your co-worker has a limited special ability: they can skip their turn, which allows you to immediately dispatch again. But the total number of skips is shared across all warehouses, and each skip costs 1 unit from the global skip budget.
## Function Signature
public int maxCredits(List inventory, int dispatch1, int dispatch2, int skips)
## Input
inventory: A list of integers where inventory[i] is the starting number of units in warehouse i.
dispatch1: Number of units you dispatch per turn.
dispatch2: Number of units your co-worker dispatches per turn.
skips: Total number of skips your co-worker can perform globally.
## Output
Return the maximum number of credits you can earn across all warehouses using at most skips total skips.
## Constraints
1 <= inventory.length <= 10^5
1 <= inventory[i] <= 10^9
1 <= dispatch1, dispatch2 <= 10^9
0 <= skips <= 10^9
### Example 1
Input:
inventory = [10, 6, 12, 8, 15, 1]
dispatch1 = 2
dispatch2 = 3
skips = 3
Output:
5
Explanation:
You can win without using any skips in 3 warehouses. Two others need 1 skip each. One warehouse needs 2 skips, which you skip. Total 3 skips used for 2 additional wins = 5 credits in total.
### Example 2
Input:
inventory = [7, 7, 7]
dispatch1 = 5
dispatch2 = 3
skips = 2
Output:
2
Explanation:
Each warehouse needs exactly 1 skip to ensure you dispatch last. You have 2 skips → 2 credits.
### Example 3
Input:
inventory = [100, 100]
dispatch1 = 10
dispatch2 = 90
skips = 0
Output:
0
Explanation:
Co-worker will always dispatch and end the warehouse. With 0 skips, you can’t alter the turn order.
## Important Notes
Skips are not per-warehouse. Each skip allows you to skip your co-worker's turn once in the sequence for any warehouse.
A warehouse may need multiple skips to allow you to be the one to finish it.
Your goal is to use your limited skips on the warehouses that give the most benefit.
## Solution Approach
## Approach
The key idea is to determine for each warehouse how many skips are required to ensure that you are the one who empties it. This can be done by simulating the dispatch process and calculating the number of skips needed for each warehouse.
## Code
public int maxCredits(List inventory, int dispatch1, int dispatch2, int skips) {
int n = inventory.size();
int totalCredits = 0;
for (int i = 0; i < n; i++) {
int units = inventory.get(i);
int skipsNeeded = 0;
while (units > dispatch1) {
units -= dispatch1;
skipsNeeded++;
units -= dispatch2;
}
if (skipsNeeded <= skips) {
totalCredits++;
skips -= skipsNeeded;
}
}
return totalCredits;
}
Interview Questions (1)
You are responsible for dispatching inventory from n warehouses. Each warehouse has a certain number of units. The dispatch process alternates turns between you and your co-worker as follows: Your Turn: You dispatch dispatch1 units. Co-worker's Turn: They dispatch dispatch2 units. Steps 1 and 2 repeat until the inventory of that warehouse becomes less than or equal to zero. You earn 1 credit if you are the one who reduces the inventory to zero or less, i.e., if the warehouse is emptied on your turn. Your co-worker has a limited special ability: they can skip their turn, which allows you to immediately dispatch again. But the total number of skips is shared across all warehouses, and each skip costs 1 unit from the global skip budget.