Flipkart DSA Questions | Compiled

Posted
18 Apr 2025
435 reads

Summary

This post provides a compiled list of Data Structures and Algorithms questions frequently encountered or asked in Flipkart's interview processes, particularly focusing on the DSA round.

How it went

DSA Round (60 mins)

  • 2 Questions (Medium level)
  • 45 mins to solve
  • 15 mins for Introduction & Q/A

Areas to focus on:

  • Time Complexity understanding
  • Edge Cases
  • Choice of best data structure.
  • Be verbose, keep it interactive.

Questions asked (13)

  1. 01

    Add Two Numbers

    Data Structures & Algorithms · Medium

    Given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.

    Open the problem
  2. 02

    LRU Cache

    Data Structures & Algorithms · Medium

    Design and implement a data structure for a Least Recently Used (LRU) cache. It should support the following operations: get and put.

    Open the problem
  3. 03

    Binary Tree Right Side View

    Data Structures & Algorithms · Medium

    Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.

    Open the problem
  4. 04

    Map with Prefix Sum

    Data Structures & Algorithms · Hard

    Design a map that allows you to do the following: Maps a string key to a given value. void insert(string key, int val): Inserts the key-val pair into the map. If the key already existed, the original key-value pair will be overridden to the new one. Int sum(string prefix): Returns the sum of the values that have a key with a prefix equal to a given string. There is an initialize() method, in case you want to initialize any internal data structure of your map.

  5. 05

    Maximize Minimum Magnetic Force

    Data Structures & Algorithms · Hard

    You have “n” empty baskets, you are given the position of the empty baskets in an array called "position", where position[i] specifies the position of the ith basket. Additionally you have m balls to be distributed among the n baskets, You have to distribute the m balls into n baskets such that the minimum magnetic force between any two balls is maximum. The magnetic force between two different balls at position x and y is defined as |x-y|.

  6. 06

    Trapping Rain Water

    Data Structures & Algorithms · Hard

    Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

    Open the problem
  7. 07

    Sliding Window Maximum

    Data Structures & Algorithms · Hard

    Print the maximum element from every k consecutive elements in an array of size n. Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Return the maximum sliding window.

  8. 08

    Count Subarrays with At Most K Distinct Elements

    Data Structures & Algorithms · Hard

    Given an integer array, print the count of subarrays which had atmost k distinct elements. Given an integer array nums and an integer k, return the number of subarrays that have at most k distinct elements.

  9. 09

    Minimum Operations to Reduce Number to Zero by Subtracting Digits

    Data Structures & Algorithms · Medium

    Given a number, find the minimum no of operations done to reduce the number to zero. An operation is defined as subtracting one of the digits from the number.

  10. 10

    Rotting Oranges

    Data Structures & Algorithms · Medium

    You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing a fresh orange, or 2 representing a rotten orange. Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minutes that must elapse until no fresh oranges are present. If this is impossible, return -1.

    Open the problem
  11. 11

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

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

    Minimum Time to Propagate Information in N-ary Tree

    Data Structures & Algorithms · Hard

    Minimum time required to propagate the information from root to all child nodes of n-ary tree where in one path, the information can only be propagated at one level and other levels will need to wait.

How they prepared

Other Rounds

Check Flipkart Tech blog

Medium articles

Topics to cover

  • Binary Search
  • Priority Queue (Min Heap and Max Heap)
  • Array
  • Trees (BFS)

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Flipkart 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!