Swiggy Interview Experience| SDE – Set 1

Company Name: Swiggy

Job Role: Software Development Engineer

Years of Experience Required: 0

Drive: Oncampus

CTC: 31.8 LPA


Topics: DSA, SQL

Duration: 1-2 months

Source of Preparation: GeeksForGeeks, Leetcode, HackerRank, Takeuforward youtube channel.


Swiggy Interview Rounds

Swiggy conducted its virtual hiring process for our campus during the second week of October.

There were a total of 3 rounds in the Swiggy on campus drive.

Round 1: Online Coding Test

This round was conducted on Hacker Rank. There was a SQL problem, and 3 coding problems.

Problem List:

Problem Statement 1: Find out the city names and country names for which the number of customers is greater than the average customer per city.

The given tables were: Country, City, Customer

Problem Statement 2: Given a string s, a substring is defined as a non-empty string that can be obtained by the following means:

  • Remove 0 or more characters from the left side of s.
  • Remove 0 or more characters from the right side of s.
  • Remove 0 or more characters from the left side of s and Remove 0 or more characters from the right side of s.

We need to find the number of distinct substrings.


Input Format: str = “ababa”

Result: 9

Explanation: Total number of distinct substring are 9, which are,
"a", "b", "ab", "ba", "aba", "bab", "abab", "baba" and "ababa"

Input Format: str = “abcde”

Result: 15

Explanation: Total number of distinct substring are 15, which are,
"a", "b", "c", "d", "e", "ab", "bc", "cd", "de", "abc", "bcd", 
"cde", "abcd", "bcde", and "abcde"

Problem Statement 3: Given a weighted undirected graph with N nodes and M edges. The stress level of a path between two nodes is defined as the weight of the edge with the maximum value present in the path. Given a source node “source” and destination node “destination”. Find the path with minimum stress level. If no such path exists, return -1.


Input Format: N = 5, M = 6, 
graph_from = {1, 1, 1, 2, 4, 5}, 
graph_to = {2, 4, 5, 3, 3, 3}, 
graph_weight = {10, 3, 4, 5, 2, 6}, 
source = 1, destination = 3

Where graph_from, graph_to, graph_weight represents the description of an edge.

Result: 3


Given graph:

There are 3 paths from source to destination. The respective stress levels for each path are:
1-2-3 : Stress level = 10
1-4-2 : Stress level = 3
1-5-3 : Stress level = 6
Hence, the minimum stress level = 3.

Problem Statement 4: There are n cars parked in the parking lot and you want to cover k cars by building a roof over them. What’s the minimum length of the roof that would cover k cars?

We are given the slots for each car.


Input Format: N = 4, cars[] = {2, 10, 8, 17}, K = 3

Result: 9

Explanation: There are 4 cars at slots 2, 10, 8, 17. 
You could build a roof of length 9 that will cover 
the slots from 2 to 10, thus covering cars at 
slots 2, 10, 8. No shorter roof could cover 3 cars.

Input Format: N = 4, cars[] = {1, 2, 3, 10}, K = 4

Result: 10

Explanation: We need to make a roof of length 10 
to cover all the slots from 1 to 10.

Round 2: DSA Round on Video Call.

This round was conducted on Google meet. This round was easier than I expected.

Topics asked: Arrays, Stack, Binary Search

Problem Statement 1: We are given an array of “asteroids” of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed. Find out the state of the asteroids after all collisions. If two asteroids meet, the smaller one will explode. If both are the same size, both will explode. Two asteroids moving in the same direction will never meet.


Input Format: asteroid[] = {5, 10, -5}

Result: {5, 10}

Explanation: The 10 and -5 will collide and the 
asteroid with value 5 will blast. 
10 and 5 will never collide.

Input Format: asteroid[] = {-2, -1, 1, 2}

Result: {-2, -1, 1, 2}

Explanation: -2 and -1 are moving to their left, 
while 1 and 2 are moving to their right. 
Thus, they will never collide.

Problem Statement 2: Find the minimum element in a rotated and sorted array.


Input Format: array[] = {5, 6, 1, 2, 3, 4}

Result: 1

Explanation: The minimum element is 1.

Round 3: HR Round

This round was also conducted on google meet. This round mainly focused on the projects done throughout college life. The interview asked to explain 2 projects in detail. I had done a couple of projects in Machine Learning, thus I explained that. Then, the interviewer asked if you have worked on any other technologies. After that, she asked if I was comfortable with Java, I answered I do not prefer Java to solve problems, but I can work with it. Then, she asked a few theoretical problems based on Java. The interview ended on a good note.

Verdict: Selected

Message to Aspiring Students:

Prepare for DSA as much as you can. It’s never too late to start.