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

SDE - 1

Swiggy
upvote
share-icon
3 rounds | 10 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Graphs, OOPS, CS subjects, Dynamic Programming
Tip
Tip

Tip 1 : Be consistent in leetcoding
Tip 2 : Make 2 projects with proper use cases
Tip 3 : Be confident and don't be disheartened with rejection

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1: Make projects which stands out
Tip 2: If you put false things it can backfire in interview

Interview rounds

01
Round
Medium
Online Coding Interview
Duration75 mins
Interview date19 Oct 2021
Coding problem3

This round started at 8 am

1. Number of Ones

Easy
15m average time
85% success
0/40
Asked in companies
AppleSnapdealSwiggy

You have been given an integer ‘NUM’. Your task is to find the number of bits which are ‘1’ in the binary representation of ‘NUM’.

Example:

Given ‘NUM = 9’
Binary representation of ‘9 = 1001’, so there are 2 times 1's present.
Print ‘2’ as the answer.
Try solving now

2. Minimum Score

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

You are given an ‘N’ sided polygon. Every vertex of the polygon is assigned a value. The vertices are given in the form of an array of ‘N’ integers in clockwise direction.

You need to divide the polygon into ‘N - 2’ triangles. Each triangle has a triangle value. The triangle value is calculated by finding the product of its vertices.

Now, you need to find the minimum total triangle score. The total triangle score is the sum of the triangle scores of all the possible triangles.

Note:
Note that a polygon can be divided into triangles in more than one way. You need to print the minimum sum of triangle values of all the triangles created.
Example :
Given 'N' = 4, Array = [4, 3, 5, 2], the possible scores for these two triangle score are: (3 * 2 * 5) + (3 * 2 * 4) = 54 and (4 * 2 * 5) + (4 * 3 * 5) = 100.
The minimum of these two triangle scores is 54. So you need to print 54.

Example

Problem approach

This can be solved by BFS DFS and DSU, i applied DFS traversal with memoization of visited nodes.

Try solving now

3. DBMS Question

Write an SQL query to find employees who have the highest salary in each of the departments.

Return the result table in any order.

Problem approach

Tip 1: Do practice for SQL queries
 

02
Round
Medium
Video Call
Duration60 minutes
Interview date19 Oct 2021
Coding problem4

1. Search In A Row Wise And Column Wise Sorted Matrix

Moderate
15m average time
80% success
0/80
Asked in companies
DirectiAdobeOracle

You are given an 'N * N' matrix of integers where each row and each column is sorted in increasing order. You are given a target integer 'X'.


Find the position of 'X' in the matrix. If it exists then return the pair {i, j} where 'i' represents the row and 'j' represents the column of the array, otherwise return {-1,-1}


For example:
If the given matrix is:
[ [1, 2, 5],
  [3, 4, 9],
  [6, 7, 10]] 
We have to find the position of 4. We will return {1,1} since A[1][1] = 4.
Problem approach

Let the given element be x, create two variable i = 0, j = n-1 as index of row and column.
Run a loop until i < n.
Check if the current element is greater than x then decrease the count of j. Exclude the current column.
Check if the current element is less than x then increase the count of i. Exclude the current row.
If the element is equal, then print the position and end.
Print the Element is not found

Try solving now

2. Min Stack

Easy
0/40
Asked in companies
Natwest GroupPayPalMorgan Stanley

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

1. Push(num): Push the given number in the stack.
2. Pop: Remove and return the top element from the stack if present, else return -1.
3. Top: return the top element of the stack if present, else return -1.
4. getMin: Returns minimum element of the stack if present, else return -1.

For Example:

For the following input: 
1
5
1 1
1 2
4
2
3

For the first two operations, we will just insert 1 and then 2 into the stack which was empty earlier. So now the stack is => [2,1]
In the third operation, we need to return the minimum element of the stack, i.e., 1. So now the stack is => [2,1]
For the fourth operation, we need to pop the topmost element of the stack, i.e., 2. Now the stack is => [1]
In the fifth operation, we return the top element of the stack, i.e. 1 as it has one element. Now the stack is => [1]

So, the final output will be: 
1 2 1
Problem approach

Create a class node that has two variables Val and min. Val will store the actual value that we are going to insert in the stack, whereas min will store the min value so far seen up to that node

Try solving now

3. Balanced parentheses

Moderate
10m average time
90% success
0/80
Asked in companies
CognizantAccenturePayPal

Given an integer ‘N’ representing the number of pairs of parentheses, Find all the possible combinations of balanced parentheses with the given number of pairs of parentheses.

Note :

Conditions for valid parentheses:
1. All open brackets must be closed by the closing brackets.

2. Open brackets must be closed in the correct order.

For Example :

()()()() is a valid parentheses.
)()()( is not a valid parentheses.
Problem approach

Declare a character stack (say temp).
Now traverse the string exp. 
If the current character is a starting bracket ( ‘(‘ or ‘{‘ or ‘[‘ ) then push it to stack.
If the current character is a closing bracket ( ‘)’ or ‘}’ or ‘]’ ) then pop from stack and if the popped character is the matching starting bracket then fine.
Else brackets are Not Balanced.
After complete traversal, if there is some starting bracket left in stack then Not balanced, else Balanced.

Try solving now

4. Valid Parentheses

Easy
10m average time
80% success
0/40
Asked in companies
OracleSwiggyAmerican Express

You're given a string 'S' consisting of "{", "}", "(", ")", "[" and "]" .


Return true if the given string 'S' is balanced, else return false.


For example:
'S' = "{}()".

There is always an opening brace before a closing brace i.e. '{' before '}', '(' before ').
So the 'S' is Balanced.
Problem approach

Let lo, hi respectively be the smallest and largest possible number of open left brackets after processing the current character in the string.

If we encounter a left bracket (c == '('), then lo++, otherwise we could write a right bracket, so lo--. If we encounter what can be a left bracket (c != ')'), then hi++, otherwise we must write a right bracket, so hi--. If hi < 0, then the current prefix can't be made valid no matter what our choices are. Also, we can never have less than 0 open left brackets. At the end, we should check that we can have exactly 0 open left brackets.

Try solving now
03
Round
Medium
Video Call
Duration30 mins
Interview date19 Oct 2021
Coding problem3

It was a Managerial Round -
Manager was a very chill and friendly person and he started with asking things about me other than my resume
 

1. HR Questions

He asked me if he had a talk with one of my professors, what will be the two positive things he will get to know about me
Similarly, he asked what will be the two negative things he will get to know about me
He asked what were steps I had taken to deal with my negatives.

2. Project based questions

He asked me to brief him about any one of my projects and asked me questions related to it like what was my motivation behind it, what were the problems faced by me, what was the tech stack I used.

3. Technical questions

He asked me in which development will I be interested in backend or Android development.
I replied with backend and then he asked me can I work full-stack too.
I said yes and then he started asking me about the differences between reactJs and vanillaJs and why I preferred react over vanilla and we had a discussion about it for 5 minutes.
He then asked me about differences between nodeJs and a framework like expressJs for server-side coding he asked me about the libraries i used for backend, problems faced in expressJs and how can we improve those problems while using express.js.
He then asked me why I used MongoDB instead of some other Database and had a discussion about it for 5 minutes
Finally, he wrapped up by asking me if I had any questions

Here's your problem of the day

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

Skill covered: Programming

To make an AI less repetitive in a long paragraph, you should increase:

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
4 rounds | 9 problems
Interviewed by Swiggy
2420 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 7 problems
Interviewed by Swiggy
1992 views
1 comments
0 upvotes
company logo
SDE - 1
3 rounds | 4 problems
Interviewed by Swiggy
1668 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 4 problems
Interviewed by Swiggy
1932 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
114453 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
57719 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
34914 views
7 comments
0 upvotes