Swiggy | SDE3 | May2022
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-06-06Added By Anonymous
Source: Link
Interview Experience: All rounds were conducted virtually on meet.
Round1: Machine Coding
Problem Statement:
1Swiggy Auto Assignment
2We are trying to build an auto assignment system for Swiggy’s delivery fleet. For simplicity we will solve the problem within the context of an area.
3Given a list of orders and a list of Delivery executives(DE), System should output list of assignments such that following attributes are cumulatively optimised:
4-> First mile (Distance between restaurant and DE’s current location): Prioritise assignment pairs with low first mile.
5-> DE waiting time(Time elapsed since DE last delivered the order): Prioritise DE with already high waiting time.
6-> Order delay time (Time elapsed since Order was placed): Prioritize Order with already high order delay.
7
8Input:
9Orders: [{“restaurant_location”:”lat1,long1”,”ordered_time”:”T1”,”id” : 123},{“restaurant_location”:”lat3,long3”,”ordered_time”:”T2”,”id”:321}]
10DEs : [{“id”:567,”current_location”:”lat5,long5”,”last_order_delivered_time”:”T3”},{“id”:765,”current_loca tion”:”lat7,long7”,”last_order_delivered_time”:”T4”},{“id”:766,”current_location”:”lat9,long9”,”last_ order_delivered_time”:”T5”}]
11
12Output: Assignments: [{“order_id”:123,”de_id”:765},{“order_id”:321, “de_id”:766}] Round 2 : Design
Focus: HLD
1Rating/Review System
21. Rate the restaurant & delivery
32. Review the restaurant
43. average ratings of rest/executive
54. Add a delivery tip. If the rating
6for delivery is below threshold, refund this
75. ratings are out of 5Round 3 : Design
Focus: LLD
1Coupon/Offer Service
2couple of use cases
31. given user_id, user_type, tnx_amount...etc return list of coupons
42. given a coupon & order_amount, payment_method, validate the coupon
5
6System should be extensible enough to add more filtering conditions later.Round 4 : Coding
Focus: Problem Solving & Data Structures.
11. Let A-1, B-2….Z-26
2Given a string of digits, find number of encodings
3E.g.
4“12” O/P: 2 (encodings possible are AB & L)
5“226” O/P: 3
6
72. Given a startWord & an endWord. You have to make changes in the start word to form the endWord. Each change is counted as one step. You can only transform to a known word in the dictionary(given as input). Find the minimum number of steps.
8E.g. wordList: ["hot", "dot", "dog", "lot", "log", "cog"]
9startWord “hit”
10endWord: “cog”.
11O/P: 4 (hit -> hot -> lot -> log -> cog)You are expected to come up with running solutions for each of the probelms.
Round 5: HM
Past experiences & standard behavioural questions.