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

SDE - 1

Swiggy
upvote
share-icon
4 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Journey
I started coding in 2nd year of college, I also participated in lots of coding contest in almost every coding platform which gives me a confidence. So my suggestion is to do participate in every coding contest.
Application story
I saw a post on linkedin about Swiggy intrested in hiring interns post, I considered it as a great opportunity for myself. I mailed the HR that I wanted to be the part of the the selection process and attached my resume. After two days, I got mailed back that your resume is selected and you will be having your interview rounds from now.
Why selected/rejected for the role?
I think my skills and knowledge were up to the mark that they found me as a valuable candidate. Moreover, my communication skills added up to my numbers.
Preparation
Duration: 3 months
Topics: Topics: Graph, Tree, Dynamic Programming, Stack, Queue, Priority Queue
Tip
Tip

Tip 1 : Participate in every coding contest
Tip 2 : Increase up solving

Application process
Where: Linkedin
Eligibility: 8 CGPA
Resume Tip
Resume tip

Tip 1 : Mention only those skills that you are confident of.
Tip 2 : You should have at least 1 good project in which you have in-depth knowledge

Interview rounds

01
Round
Easy
Video Call
Duration60 minutes
Interview date7 Mar 2021
Coding problem2

1. Anagram Pairs

Moderate
30m average time
60% success
0/80
Asked in companies
JP MorganNearbuyTata Consultancy Services (TCS)

You are given two strings 'str1' and 'str1'.


You have to tell whether these strings form an anagram pair or not.


The strings form an anagram pair if the letters of one string can be rearranged to form another string.

Pre-requisites:

Anagrams are defined as words or names that can be formed by rearranging the letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "rasp" are anagrams. 

Other examples include:

'triangle' and 'integral'
'listen' and 'silent'
Note:
Since it is a binary problem, there is no partial marking. Marks will only be awarded if you get all the test cases correct. 
Problem approach

I simply used hashing to solve this problem by checking the frequency of characters in both strings.

Try solving now

2. Circular Tour

Easy
35m average time
85% success
0/40
Asked in companies
AdobeMicrosoftExpedia Group

You have been given a circular path. There are N petrol pumps on this path that are numbered from 0 to N - 1 (Both inclusive). Each petrol pump has two values associated with it:

1)The amount of petrol that is available at this particular petrol pump.

2)The distance to reach the next petrol pump.

You are on a truck having an empty tank of infinite capacity. You can start the tour from any of the petrol pumps. Your task is to calculate the first petrol pump from where the truck will be able to complete the full circle or determine if it is impossible to do so.

You may assume that the truck will stop at every petrol pump and it will add the petrol from that pump to its tank. The truck will move one kilometre for each litre of petrol consumed.

Problem approach

I simply started from 0,0 point and if the robot again reaches to 0,0 point then motion is circular. I explained my whole approach on paper to the interviewer.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date9 Mar 2021
Coding problem2

1. Next Greater Number

Moderate
15m average time
90% success
0/80
Asked in companies
Thought WorksPaytm (One97 Communications Limited)Hike

You are given a string S which represents a number. You have to find the smallest number strictly greater than the given number which contains the same set of digits as of the original number i.e the frequency of each digit from 0 to 9 should be exactly the same as in the original number.

For example:
If the given string is 56789, then the next greater number is 56798. Note that although 56790 is also greater than the given number it contains 1 '0' which is not in the original number and also it does not contain the digit '8'.

Note:

The given string is non-empty.

If the answer does not exist, then return -1.

The given number does not contain any leading zeros.
Problem approach

I have done this question earlier so just use already built algorithm which traverses the number from the back.

Try solving now

2. Find Number Of Islands

Moderate
34m average time
60% success
0/80
Asked in companies
MicrosoftAmazonUber

You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.

A cell is said to be connected to another cell, if one cell lies immediately next to the other cell, in any of the eight directions (two vertical, two horizontal, and four diagonals).

A group of connected cells having value 1 is called an island. Your task is to find the number of such islands present in the matrix.

Problem approach

Simply gave the interviewer, Depth-first search based approach by visiting adjacent connected components and counting the number of islands. The interviewer was satisfied with my approach.

Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date10 Mar 2021
Coding problem2

1. Reverse Stack Using Recursion

Easy
21m average time
80% success
0/40
Asked in companies
RazorpayAmazonCIS - Cyber Infrastructure

Reverse a given stack of 'N' integers using recursion. You are required to make changes in the input parameter itself.


Note: You are not allowed to use any extra space other than the internal stack space used due to recursion.


Example:
Input: [1,2,3,4,5] 
Output: [5,4,3,2,1]

add image

Problem approach

I told him proper algorithm with code on paper to the interviewer. He asked me to dry run the algorithm which I did by taking an example of stack.

Try solving now

2. Leftmost and rightmost nodes in a binary tree

Easy
20m average time
80% success
0/40
Asked in companies
AdobeSAP LabsPaytm (One97 Communications Limited)

You are given an arbitrary binary tree with N nodes, whose nodes have their values in the range of integers. You have to print the values of leftmost and rightmost nodes at each level of the given tree. In other words, for every level in the given tree, print the values of corner nodes.

Two nodes are said to be at the same level if they are at the same distance from the root node.

Note:

1. For all such levels where there is only one corner node the leftmost and the rightmost nodes are the same.
2. In the output, you have to print the leftmost and rightmost values in level order fashion i.e, the leftmost node of level1 followed by the rightmost node of level1 followed by the leftmost node of level2 followed by the rightmost node of level2 and so on.
Problem approach

I used Level order approach to solve this question and the interviewer was quite satisfied with my approach and he was happy with my response.

Try solving now
04
Round
Easy
Face to Face
Duration30 minutes
Interview date29 Mar 2021
Coding problem1

1. Find K’th Character of Decrypted String

Moderate
33m average time
0/80
Asked in companies
AmazonAdobeMicrosoft

You have been given an Encrypted String where repetitions of substrings are represented as substring followed by the count of substrings.

Example: String "aabbbcdcdcd" will be encrypted as "a2b3cd3".

You need to find the 'K'th character of Decrypted String. Decrypted String would have 1-based indexing.

Note :

Input string will always be lowercase characters without any spaces.

If the count of a substring is 1 then also it will be followed by Integer '1'.
Example: "aabcdee" will be Encrypted as "a2bcd1e2"
This means it's guaranteed that each substring is followed by some Integer.

Also, the frequency of encrypted substring can be of more than one digit. For example, in "ab12c3", ab is repeated 12 times. No leading 0 is present in the frequency of substring.

The frequency of a repeated substring can also be in parts.
Example: "aaaabbbb" can also have "a2a2b3b1" as Encrypted String.
Problem approach

I simply decrypt the string by reading substring and their frequency and append current substring to the decrypted string and after the end of traversal of given string our answer will be kth element of the decrypted string.

Try solving now

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
2419 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 | 10 problems
Interviewed by Swiggy
1516 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