Flipkart DSA Questions | Compiled

flipkart logo
flipkart
April 18, 2025 • 12 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.

Full Experience

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.

Interview Questions (13)

Q1
Add Two Numbers
Data Structures & AlgorithmsMedium

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.

Q2
LRU Cache
Data Structures & AlgorithmsMedium

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

Q3
Binary Tree Right Side View
Data Structures & AlgorithmsMedium

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.

Q4
Map with Prefix Sum
Data Structures & AlgorithmsHard

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.

Q5
Maximize Minimum Magnetic Force
Data Structures & AlgorithmsHard

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

Q6
Trapping Rain Water
Data Structures & AlgorithmsHard

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.

Q7
Sliding Window Maximum
Data Structures & AlgorithmsHard

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.

Q8
Count Subarrays with At Most K Distinct Elements
Data Structures & AlgorithmsHard

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.

Q9
Minimum Operations to Reduce Number to Zero by Subtracting Digits
Data Structures & AlgorithmsMedium

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.

Q10
Rotting Oranges
Data Structures & AlgorithmsMedium

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.

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

Q12
Longest Substring Without Repeating Characters
Data Structures & AlgorithmsMedium

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

Q13
Minimum Time to Propagate Information in N-ary Tree
Data Structures & AlgorithmsHard

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.

Preparation Tips

Other Rounds

Check Flipkart Tech blog

Medium articles

Topics to cover

  • Binary Search
  • Priority Queue (Min Heap and Max Heap)
  • Array
  • Trees (BFS)
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!