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
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 atleast 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.