Swiggy SDE-3 Interview Experience
Summary
I interviewed for an SDE-3 position at Swiggy, completing PS/DS, machine‑coding, LLD and HLD rounds.
Full Experience
PS/DS round
Question 1
Few Restaurants are situated on a straight road (1D road) that can be approached from either side (left or right). They contain the number of orders it has ready to be delivered.
There are 2 delivery executives “Ram” and “Raju” present to deliver at the moment.
The delivery company has provided the Delivery Executives a vehicle to deliver multiple orders at once.
But there is a catch that once a delivery executive goes to a Restaurant,
He has to first deliver all the orders from that restaurant first before getting a chance to visit another restaurant again.
The second condition is that, the first restaurant he comes across, he has to select that restaurant only. He cannot skip the Restaurant in sight for another Restaurant. This leads to a Delivery Executive either delivering for the first Restaurant he comes across from left, or first Restaurant he comes up from right.
This leads to a situation where “Ram” and “Raju” end up taking turns to visit restaurants alternatively. Each of them knows how many orders are ready to be delivered per Restaurant in the APP.
The objective is to help “Ram” decide in such a way that he is able to maximize the number of orders he can deliver assuming “Raju” also tries to maximize his orders. Also to print how many orders “Ram” is able to deliver.
Assume “Ram” has a chance to choose for the first time which restaurant he wants to deliver for, and “Raju” comes next.
Input: 1, 6, 9, 3
Output: Ram delivers 10 orders.
1, 6, 9, 3 1
6, 9, 3 6
9, 3 9
3 3
Orders count: 10 orders 9 orders
[8, 15, 3, 7]
Output: 22
[10, 100, 20, 1]
Output: 101
[20, 30, 2, 2, 2, 10]
Output: 42
Machine Coding
OrderManagement
1. Find Order Price Based on Slots given
2. Slots have Base Delivery Fee + Capacity
3. Based On capacity, there is surge Multiplier
if (utilization <= 0.5) {
return 1.0;
} else if (utilization <= 0.8) {
return 1.2;
} else {
return 1.5;
}
4. Order to be assigned to nearest slot based on order placed time
5. Slot Status to be printed when needed
LLD round
View for customers to Filter and rank restaurants around their location based on their own preferences
Get top N highest rated restaurants in the city: ordered by rating desc
Get top N highest rated restaurants in the city with predicted delivery time < 30 mins: ordered by rating desc
Get top N least delivery time restaurants for the customer location in the city with rating at least 4.0/5.0: ordered by delivery time asc
…
HLD round
You're building a Driver Assignment System for a food delivery platform(similar to Swiggy/Uber Eats).
The system needs to automatically assign delivery drivers to orders in real-time while optimizing for multiple objectives.
Interview Questions (1)
Maximize Orders Delivered by Ram
Few Restaurants are situated on a straight road (1D road) that can be approached from either side (left or right). Each restaurant has a certain number of orders ready for delivery.
Two delivery executives, Ram and Raju, share a vehicle that can carry multiple orders at once. When a delivery executive visits a restaurant, they must deliver all orders from that restaurant before moving to another.
The first restaurant an executive encounters (from the chosen direction) must be selected; they cannot skip it for another restaurant. Consequently, each executive will always take the first restaurant they see from the left or right.
Ram and Raju take turns visiting restaurants, starting with Ram who gets to choose the initial direction (leftmost or rightmost restaurant). Both aim to maximize the total number of orders they deliver.
Given the list of order counts for the restaurants in their order along the road, determine the maximum number of orders Ram can deliver assuming optimal play by both.
Example Inputs and Outputs:
- Input: [1, 6, 9, 3] → Output: Ram delivers 10 orders.
- Input: [8, 15, 3, 7] → Output: 22
- Input: [10, 100, 20, 1] → Output: 101
- Input: [20, 30, 2, 2, 2, 10] → Output: 42