SWIGGY ALL INTERVIEW QUESTIONS

swiggy logo
swiggy
· Ongoing
September 1, 2022 · 254 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)

1.

Rotting Oranges (Similar)

Data Structures & Algorithms·Medium

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.

2.

Find the Duplicate Number

Data Structures & Algorithms·Medium

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.

3.

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.

4.

Group Anagrams

Data Structures & Algorithms·Medium

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

5.

Merge k Sorted Lists

Data Structures & Algorithms·Hard

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.

6.

Course Schedule II (Modified)

Data Structures & Algorithms·Medium

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.

7.

Subarray Sum Equals K (Modified)

Data Structures & Algorithms·Medium

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.

8.

Subarray Sums Divisible by K

Data Structures & Algorithms·Medium

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

9.

Lowest Common Ancestor of a Binary Tree

Data Structures & Algorithms·Medium

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

10.

Alien Dictionary

Data Structures & Algorithms·Hard

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.

11.

Building Bridges

Data Structures & Algorithms·Hard

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.

12.

Design LRU Cache

System Design·Medium

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.

13.

Coin Change (Similar)

Data Structures & Algorithms·Medium

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.

14.

Surrounded Regions

Data Structures & Algorithms·Medium

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.

15.

Maximum Length of Pair Chain

Data Structures & Algorithms·Medium

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.

16.

Find All Greater Numbers Formed by Digits

Data Structures & Algorithms·Medium

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.

17.

Nearest Node Value in Binary Tree

Data Structures & Algorithms·Easy

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

18.

String Replacement with Mismatched Substrings

Data Structures & Algorithms·Medium

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.

19.

Game on Circular Array (Maximizing Score)

Data Structures & Algorithms·Hard

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.

20.

Palindrome Pairs

Data Structures & Algorithms·Hard

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.

21.

Climbing Stairs

Data Structures & Algorithms·Easy

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?

22.

Jump Game III

Data Structures & Algorithms·Medium

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?

23.

Jump Game II

Data Structures & Algorithms·Medium

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.

24.

Longest Substring Without Repeating Characters

Data Structures & Algorithms·Medium

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!