Swiggy private limited interview experience Real time questions & tips from candidates to crack your interview

SDE - 2

Swiggy private limited
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Be thorough with the concepts
Tip 2 : Practice coding questions daily

Application process
Where: Referral
Eligibility: No criteria
Resume Tip
Resume tip

Tip 1: Be honest and do not lie on resume
Tip 2: Keep it short and precise

Interview rounds

01
Round
Medium
Online Coding Interview
Duration60 minutes
Interview date1 Sep 2022
Coding problem2

2 coding questions

1. Minimum Number of Platforms

Moderate
30m average time
70% success
0/80
Asked in companies
MeeshoGrabAmazon

You have been given two arrays, 'AT' and 'DT', representing the arrival and departure times of all trains that reach a railway station.

Your task is to find the minimum number of platforms required for the railway station so that no train needs to wait.

Note :
1. Every train will depart on the same day and the departure time will always be greater than the arrival time. For example, A train with arrival time 2240 and departure time 1930 is not possible.

2. Time will be given in 24H format and colons will be omitted for convenience. For example, 9:05AM will be given as "905", or 9:10PM will be given as "2110".

3. Also, there will be no leading zeroes in the given times. For example, 12:10AM will be given as “10” and not as “0010”.
Problem approach

The problem can be solved using Dynamic Programming. Follow the steps below to solve the problem: 

traverse the array and for every array index, i.e. ith fountain, find the leftmost fountain up to which the current fountain covers.
Then, find the rightmost fountain that the leftmost fountain obtained in the above step covers up to and update it in the dp[] array.
Initialize a variable cntFount to store the minimum number of fountains that need to be activated.
Now, traverse the dp[] array and keep activating the fountains from the left that covers maximum fountains currently on the right and increment cntFount by 1. Finally, print cntFount as the required answer.

Try solving now

2. Count with K different characters

Moderate
15m average time
85% success
0/80
Asked in companies
CIS - Cyber InfrastructureAmazonWalmart

You are given a string 'str' of lowercase alphabets and an integer 'k' .


Your task is to return the count all the possible substrings that have exactly 'k' distinct characters.


For example:

'str' = abcad and 'k' = 2. 

We can see that the substrings {ab, bc, ca, ad} are the only substrings with 2 distinct characters. 

Therefore, the answer will be 4.    
Problem approach

The idea is to traverse through all substrings. We fix a starting point, traverse through all substrings starting with the picked point, we keep incrementing frequencies of all characters. If all frequencies become k, we increment the result. If the count of any frequency becomes more than k, we break and change starting point.

Try solving now
02
Round
Medium
Video Call
Duration50 minutes
Interview date4 Sep 2022
Coding problem2

1. Next Greater Element

Moderate
20m average time
90% success
0/80
Asked in companies
CIS - Cyber InfrastructureAmazonPhonePe

You are given an array arr of length N. You have to return a list of integers containing the NGE(next greater element) of each element of the given array. The NGE for an element X is the first greater element on the right side of X in the array. Elements for which no greater element exists, consider the NGE as -1.

For Example :

If the given array is [1, 3, 2], then you need to return [3, -1, -1]. Because for 1, 3 is the next greater element, for 3 it does not have any greater number to its right, and similarly for 2.
Problem approach

We sort all elements, then for every element, traverse toward right until we find a greater element

Try solving now

2. Construct Binary Tree From Inorder and Preorder Traversal

Easy
10m average time
90% success
0/40
Asked in companies
FacebookPayUIBM

You have been given the preorder and inorder traversal of a binary tree. Your task is to construct a binary tree using the given inorder and preorder traversals.


Note:
You may assume that duplicates do not exist in the given traversals.
For example :
For the preorder sequence = [1, 2, 4, 7, 3] and the inorder sequence = [4, 2, 7, 1, 3], we get the following binary tree.

Example

Problem approach

Even though I have already solved this question thrice before the interview, still I could not code it. Please keep in mind that even the simpler questions seem to be pretty difficult in the tense situation of the interview. However I told the approach for the question (Recursion + left-right pointers) and they wrapped the interview, as we were already out of time.

Try solving now
03
Round
Medium
Video Call
Duration40 min
Interview date7 Sep 2022
Coding problem1

Puzzle solving

1. Puzzle

Ishita has 10 bags full of coins. Each bag contains 1000 coins. But one bag is full of forgeries, and she just can’t recall which one. She does know that genuine coins weigh 1 gram, but forgeries weigh 1.1 grams. To hide the fact that she can’t recall which bag contains forgeries, she needs your help. How can she identify the bag with the forgeries with just one weighing?

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
SDE - 2
4 rounds | 3 problems
Interviewed by Swiggy private limited
2729 views
0 comments
0 upvotes
SDET-2
3 rounds | 3 problems
Interviewed by Swiggy private limited
3247 views
0 comments
0 upvotes
SDE - 1
3 rounds | 4 problems
Interviewed by Swiggy private limited
6857 views
1 comments
0 upvotes
SDE - 1
3 rounds | 4 problems
Interviewed by Swiggy private limited
1944 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 2
5 rounds | 12 problems
Interviewed by Walmart
29569 views
8 comments
0 upvotes
company logo
SDE - 2
3 rounds | 4 problems
Interviewed by HashedIn
9583 views
0 comments
0 upvotes
company logo
SDE - 2
3 rounds | 5 problems
Interviewed by Amazon
6677 views
1 comments
0 upvotes