SWIGGY ALL INTERVIEW QUESTIONS

Result
Ongoing
Posted
1 Sept 2022
588 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.

How it went

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.

Questions asked (24)

  1. 01

    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.

    Open the problem
  2. 02

    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.

    Open the problem
  3. 03

    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. 04

    Group Anagrams

    Data Structures & Algorithms · Medium

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

    Open the problem
  5. 05

    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.

    Open the problem
  6. 06

    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.

    Open the problem
  7. 07

    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.

    Open the problem
  8. 08

    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.

    Open the problem
  9. 09

    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.

    Open the problem
  10. 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.

    Open the problem
  11. 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. 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.

    Open the problem
  13. 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.

    Open the problem
  14. 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.

    Open the problem
  15. 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.

    Open the problem
  16. 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. 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. 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.

    Open the problem
  19. 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. 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.

    Open the problem
  21. 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?

    Open the problem
  22. 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?

    Open the problem
  23. 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.

    Open the problem
  24. 24

    Longest Substring Without Repeating Characters

    Data Structures & Algorithms · Medium

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

    Open the problem

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Swiggy recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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