SWIGGY ALL INTERVIEW QUESTIONS

swiggy logo
swiggy
Ongoing
September 1, 20220 reads

Summary

I have compiled a comprehensive list of interview questions encountered during Swiggy's onsite interviews for both SDE-1 and SDE-2 roles, covering a wide range of LeetCode problems and system design challenges.

Full Experience

I've gathered these interview questions from various Swiggy SDE-1 and SDE-2 onsite rounds. This collection provides insights into the types of problems asked, encompassing classic data structures and algorithms, with direct references to many LeetCode problems, as well as several conceptual and system design questions. It serves as a valuable resource for anyone preparing for technical interviews at Swiggy.

Interview Questions (24)

Q1
Rotting Oranges (Similar)
Data Structures & AlgorithmsMedium

A problem similar to Rotting Oranges, which typically involves a grid of fresh, rotten, and empty oranges. Fresh oranges rot if adjacent to a rotten orange. The goal is to find the minimum time until all fresh oranges rot or if it's impossible for all fresh oranges to rot.

Q2
Find the Duplicate Number
Data Structures & AlgorithmsMedium

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive). Prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. The interviewer specifically looked for an O(1) space complexity solution.

Q3
Nth Recently Used Number in Stream
Data Structures & Algorithms

Given a stream of numbers, find the nth most recently recurring number. For example, if the stream is [1, 1, 2, 3, 2, 4] and n = 2, the output should be the 2nd most recently recurring number. This problem implies tracking both frequency and recency of numbers in a stream.

Q4
Group Anagrams
Data Structures & AlgorithmsMedium

Given an array of strings strs, group the anagrams together. You can return the answer in any order.

Q5
Merge k Sorted Lists
Data Structures & AlgorithmsHard

You are given an array of k linked-lists, each sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it.

Q6
Course Schedule II (Modified)
Data Structures & AlgorithmsMedium

A problem with a slight modification based on Course Schedule II. The original problem asks to return the ordering of courses you should take to finish all courses, or an empty array if it's impossible. The core problem involves topological sorting.

Q7
Subarray Sum Equals K (Modified)
Data Structures & AlgorithmsMedium

A modified version of the Subarray Sum Equals K problem. The original problem asks to find the total number of continuous subarrays whose sum equals k.

Q8
Subarray Sums Divisible by K
Data Structures & AlgorithmsMedium

Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible by k.

Q9
Lowest Common Ancestor of a Binary Tree
Data Structures & AlgorithmsMedium

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.

Q10
Alien Dictionary
Data Structures & AlgorithmsHard

There is a new alien language that uses the English alphabet. However, the order among the letters is unknown to you. You are given a list of words from the alien language's dictionary, where the words are sorted lexicographically by the rules of this new language. Derive the order of the letters in this language.

Q11
Building Bridges
Data Structures & AlgorithmsHard

This problem typically involves finding the maximum number of non-crossing bridges that can be built between two banks of a river, given coordinates for cities on both banks. It's a classic dynamic programming problem, often solved using a variation of the Longest Increasing Subsequence algorithm.

Q12
Design LRU Cache
System DesignMedium

Design a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capacity) initializes the LRU cache with positive size capacity. int get(int key) returns the value of the key if the key exists, otherwise returns -1. void put(int key, int value) updates the value of the key if the key exists. Otherwise, add the key-value pair to the cache. If the number of keys exceeds the capacity from this operation, evict the least recently used key.

Q13
Coin Change (Similar)
Data Structures & AlgorithmsMedium

A problem similar to the Coin Change problem. The standard Coin Change problem asks for the fewest number of coins needed to make up a certain amount, or the number of combinations of coins that sum up to a given amount.

Q14
Surrounded Regions
Data Structures & AlgorithmsMedium

Given an m x n matrix board containing 'X' and 'O', capture all regions that are 4-directionally surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. Regions touching the border are not considered surrounded.

Q15
Maximum Length of Pair Chain
Data Structures & AlgorithmsMedium

You are given n pairs of numbers, pairs[i] = [starti, endi]. A pair (c, d) follows a pair (a, b) if b < c. A chain of pairs can be formed in this fashion. Return the length of the longest chain which can be formed.

Q16
Find All Greater Numbers Formed by Digits
Data Structures & AlgorithmsMedium

Given a number, find all possible numbers that can be formed using its digits which are greater than the given number. For example, if the input is 213, the output should include 231, 312, 321. This typically involves generating permutations.

Q17
Nearest Node Value in Binary Tree
Data Structures & AlgorithmsEasy

Given a binary tree and a target value, find the node value in the tree that is closest to the target value.

Q18
String Replacement with Mismatched Substrings
Data Structures & AlgorithmsMedium

Given a string S, a source array source, a target array target, and an index array indices. For each i, if the substring of S starting at indices[i] matches source[i], then replace that substring with target[i]. Otherwise, do nothing. Replacements are independent and should be performed simultaneously.

Q19
Game on Circular Array (Maximizing Score)
Data Structures & AlgorithmsHard

Two players take turns picking one element from either end of a circular array. The goal for each player is to maximize their own score. The problem asks to find the maximum possible gain for the first player and determine if the first player always wins.

Q20
Palindrome Pairs
Data Structures & AlgorithmsHard

Given a list of unique words, return all the pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words words[i] + words[j] is a palindrome.

Q21
Climbing Stairs
Data Structures & AlgorithmsEasy

You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Q22
Jump Game III
Data Structures & AlgorithmsMedium

Given an array of non-negative integers arr and a start index start. You are initially at start. When you are at index i, you can jump to i + arr[i] or i - arr[i]. Can you reach any index with value 0?

Q23
Jump Game II
Data Structures & AlgorithmsMedium

Given an array of non-negative integers nums, you are initially positioned at the first index. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of jumps.

Q24
Longest Substring Without Repeating Characters
Data Structures & AlgorithmsMedium

Given a string s, find the length of the longest substring without repeating characters.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!