Flipkart Placement Papers 2024
Access 2024 Flipkart OA questions with solutions and exam pattern analysis.
Practice with 25+ Flipkart placement paper coding questions covering DSA problems, algorithms, and system design concepts. These questions are representative of what you’ll encounter in Flipkart’s online assessment and technical interviews.
What’s Included:
Flipkart Placement Papers 2024
Access 2024 Flipkart OA questions with solutions and exam pattern analysis.
Flipkart Placement Papers 2025
Practice latest 2025 Flipkart OA questions with updated patterns.
Complete Flipkart guide
Access complete Flipkart placement papers guide with eligibility, process, and preparation strategy.
Flipkart Online Assessment Breakdown:
| Section | Questions | Time | Difficulty | Focus Areas |
|---|---|---|---|---|
| Coding Test | 2-3 | 60-90 min | Medium-Hard | Arrays, graphs, DP, system design |
Languages Allowed: Java, C++, Python, Go
Problem: Find the contiguous subarray with the largest sum.
Example:
Input: [-2,1,-3,4,-1,2,1,-5,4]Output: 6 (subarray [4,-1,2,1])Solution (Java):
public int maxSubArray(int[] nums) { int maxSoFar = nums[0]; int maxEndingHere = nums[0];
for (int i = 1; i < nums.length; i++) { maxEndingHere = Math.max(nums[i], maxEndingHere + nums[i]); maxSoFar = Math.max(maxSoFar, maxEndingHere); } return maxSoFar;}Solution (Python):
def max_sub_array(nums): max_so_far = max_ending_here = nums[0] for num in nums[1:]: max_ending_here = max(num, max_ending_here + num) max_so_far = max(max_so_far, max_ending_here) return max_so_farTime Complexity: O(n) | Space Complexity: O(1)
Problem: Calculate water trapped after raining.
Example:
Input: [0,1,0,2,1,0,1,3,2,1,2,1]Output: 6Solution (Java):
public int trap(int[] height) { int left = 0, right = height.length - 1; int leftMax = 0, rightMax = 0; int water = 0;
while (left < right) { if (height[left] < height[right]) { if (height[left] >= leftMax) { leftMax = height[left]; } else { water += leftMax - height[left]; } left++; } else { if (height[right] >= rightMax) { rightMax = height[right]; } else { water += rightMax - height[right]; } right--; } } return water;}Time Complexity: O(n) | Space Complexity: O(1)
Problem: Merge overlapping intervals.
Example:
Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Solution (Java):
public int[][] merge(int[][] intervals) { Arrays.sort(intervals, (a, b) -> a[0] - b[0]); List<int[]> result = new ArrayList<>();
for (int[] interval : intervals) { if (result.isEmpty() || result.get(result.size()-1)[1] < interval[0]) { result.add(interval); } else { result.get(result.size()-1)[1] = Math.max(result.get(result.size()-1)[1], interval[1]); } } return result.toArray(new int[result.size()][]);}Time Complexity: O(n log n) | Space Complexity: O(n)
Problem: Find all unique triplets that sum to zero.
Solution (Java):
public List<List<Integer>> threeSum(int[] nums) { Arrays.sort(nums); List<List<Integer>> result = new ArrayList<>();
for (int i = 0; i < nums.length - 2; i++) { if (i > 0 && nums[i] == nums[i-1]) continue;
int left = i + 1, right = nums.length - 1; while (left < right) { int sum = nums[i] + nums[left] + nums[right]; if (sum == 0) { result.add(Arrays.asList(nums[i], nums[left], nums[right])); while (left < right && nums[left] == nums[left+1]) left++; while (left < right && nums[right] == nums[right-1]) right--; left++; right--; } else if (sum < 0) { left++; } else { right--; } } } return result;}Time Complexity: O(n²) | Space Complexity: O(1)
Problem: Find length of longest consecutive elements sequence.
Example:
Input: [100,4,200,1,3,2]Output: 4 (sequence [1,2,3,4])Solution (Java):
public int longestConsecutive(int[] nums) { Set<Integer> set = new HashSet<>(); for (int num : nums) set.add(num);
int maxLen = 0; for (int num : set) { if (!set.contains(num - 1)) { int currentNum = num; int length = 1;
while (set.contains(currentNum + 1)) { currentNum++; length++; } maxLen = Math.max(maxLen, length); } } return maxLen;}Time Complexity: O(n) | Space Complexity: O(n)
Problem: Count islands in a 2D grid.
Solution (Java):
public int numIslands(char[][] grid) { int count = 0; for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { if (grid[i][j] == '1') { dfs(grid, i, j); count++; } } } return count;}
private void dfs(char[][] grid, int i, int j) { if (i < 0 || i >= grid.length || j < 0 || j >= grid[0].length || grid[i][j] == '0') return; grid[i][j] = '0'; dfs(grid, i+1, j); dfs(grid, i-1, j); dfs(grid, i, j+1); dfs(grid, i, j-1);}Time Complexity: O(m×n) | Space Complexity: O(m×n)
Problem: Determine if you can finish all courses given prerequisites (cycle detection).
Solution (Java):
public boolean canFinish(int numCourses, int[][] prerequisites) { List<List<Integer>> graph = new ArrayList<>(); int[] inDegree = new int[numCourses];
for (int i = 0; i < numCourses; i++) { graph.add(new ArrayList<>()); }
for (int[] p : prerequisites) { graph.get(p[1]).add(p[0]); inDegree[p[0]]++; }
Queue<Integer> queue = new LinkedList<>(); for (int i = 0; i < numCourses; i++) { if (inDegree[i] == 0) queue.offer(i); }
int count = 0; while (!queue.isEmpty()) { int course = queue.poll(); count++; for (int next : graph.get(course)) { if (--inDegree[next] == 0) queue.offer(next); } } return count == numCourses;}Time Complexity: O(V+E) | Space Complexity: O(V+E)
Problem: Deep copy of a graph.
Solution (Java):
public Node cloneGraph(Node node) { if (node == null) return null;
Map<Node, Node> visited = new HashMap<>(); return dfs(node, visited);}
private Node dfs(Node node, Map<Node, Node> visited) { if (visited.containsKey(node)) { return visited.get(node); }
Node clone = new Node(node.val, new ArrayList<>()); visited.put(node, clone);
for (Node neighbor : node.neighbors) { clone.neighbors.add(dfs(neighbor, visited)); } return clone;}Time Complexity: O(V+E) | Space Complexity: O(V)
Problem: Find LCA of two nodes in binary tree.
Solution (Java):
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if (root == null || root == p || root == q) return root;
TreeNode left = lowestCommonAncestor(root.left, p, q); TreeNode right = lowestCommonAncestor(root.right, p, q);
if (left != null && right != null) return root; return left != null ? left : right;}Time Complexity: O(n) | Space Complexity: O(h)
Problem: Find shortest path from top-left to bottom-right in binary matrix.
Solution (Java):
public int shortestPathBinaryMatrix(int[][] grid) { int n = grid.length; if (grid[0][0] == 1 || grid[n-1][n-1] == 1) return -1;
int[][] dirs = {{0,1},{1,0},{0,-1},{-1,0},{1,1},{-1,-1},{1,-1},{-1,1}}; Queue<int[]> queue = new LinkedList<>(); queue.offer(new int[]{0, 0, 1}); grid[0][0] = 1;
while (!queue.isEmpty()) { int[] cell = queue.poll(); int r = cell[0], c = cell[1], dist = cell[2];
if (r == n-1 && c == n-1) return dist;
for (int[] dir : dirs) { int nr = r + dir[0], nc = c + dir[1]; if (nr >= 0 && nr < n && nc >= 0 && nc < n && grid[nr][nc] == 0) { grid[nr][nc] = 1; queue.offer(new int[]{nr, nc, dist + 1}); } } } return -1;}Time Complexity: O(n²) | Space Complexity: O(n²)
Problem: Find length of longest increasing subsequence.
Example:
Input: [10,9,2,5,3,7,101,18]Output: 4 ([2,3,7,101])Solution (Java):
public int lengthOfLIS(int[] nums) { int[] tails = new int[nums.length]; int size = 0;
for (int num : nums) { int left = 0, right = size; while (left < right) { int mid = (left + right) / 2; if (tails[mid] < num) { left = mid + 1; } else { right = mid; } } tails[left] = num; if (left == size) size++; } return size;}Time Complexity: O(n log n) | Space Complexity: O(n)
Problem: Find minimum coins needed to make amount.
Solution (Java):
public int coinChange(int[] coins, int amount) { int[] dp = new int[amount + 1]; Arrays.fill(dp, amount + 1); dp[0] = 0;
for (int i = 1; i <= amount; i++) { for (int coin : coins) { if (coin <= i) { dp[i] = Math.min(dp[i], dp[i - coin] + 1); } } } return dp[amount] > amount ? -1 : dp[amount];}Time Complexity: O(amount × coins) | Space Complexity: O(amount)
Problem: Check if string can be segmented into dictionary words.
Solution (Java):
public boolean wordBreak(String s, List<String> wordDict) { Set<String> dict = new HashSet<>(wordDict); boolean[] dp = new boolean[s.length() + 1]; dp[0] = true;
for (int i = 1; i <= s.length(); i++) { for (int j = 0; j < i; j++) { if (dp[j] && dict.contains(s.substring(j, i))) { dp[i] = true; break; } } } return dp[s.length()];}Time Complexity: O(n²) | Space Complexity: O(n)
Problem: Find the longest palindromic substring.
Solution (Java):
public String longestPalindrome(String s) { if (s == null || s.length() < 1) return ""; int start = 0, end = 0;
for (int i = 0; i < s.length(); i++) { int len1 = expandAroundCenter(s, i, i); int len2 = expandAroundCenter(s, i, i + 1); int len = Math.max(len1, len2);
if (len > end - start) { start = i - (len - 1) / 2; end = i + len / 2; } } return s.substring(start, end + 1);}
private int expandAroundCenter(String s, int left, int right) { while (left >= 0 && right < s.length() && s.charAt(left) == s.charAt(right)) { left--; right++; } return right - left - 1;}Time Complexity: O(n²) | Space Complexity: O(1)
Problem: Find contiguous subarray with largest product.
Solution (Java):
public int maxProduct(int[] nums) { int maxProd = nums[0], minProd = nums[0], result = nums[0];
for (int i = 1; i < nums.length; i++) { if (nums[i] < 0) { int temp = maxProd; maxProd = minProd; minProd = temp; }
maxProd = Math.max(nums[i], maxProd * nums[i]); minProd = Math.min(nums[i], minProd * nums[i]); result = Math.max(result, maxProd); } return result;}Time Complexity: O(n) | Space Complexity: O(1)
Problem: Design LRU cache with O(1) get and put.
Solution (Java):
class LRUCache { private int capacity; private Map<Integer, Node> cache; private Node head, tail;
class Node { int key, value; Node prev, next; Node(int k, int v) { key = k; value = v; } }
public LRUCache(int capacity) { this.capacity = capacity; cache = new HashMap<>(); head = new Node(0, 0); tail = new Node(0, 0); head.next = tail; tail.prev = head; }
public int get(int key) { if (!cache.containsKey(key)) return -1; Node node = cache.get(key); remove(node); insert(node); return node.value; }
public void put(int key, int value) { if (cache.containsKey(key)) { remove(cache.get(key)); } if (cache.size() == capacity) { remove(tail.prev); } insert(new Node(key, value)); }
private void remove(Node node) { cache.remove(node.key); node.prev.next = node.next; node.next.prev = node.prev; }
private void insert(Node node) { cache.put(node.key, node); node.next = head.next; node.prev = head; head.next.prev = node; head.next = node; }}Time Complexity: O(1) | Space Complexity: O(capacity)
Problem: Design a simplified Twitter with post, follow, getNewsFeed.
Solution (Java):
class Twitter { private Map<Integer, Set<Integer>> following; private Map<Integer, List<int[]>> tweets; private int timestamp;
public Twitter() { following = new HashMap<>(); tweets = new HashMap<>(); timestamp = 0; }
public void postTweet(int userId, int tweetId) { tweets.computeIfAbsent(userId, k -> new ArrayList<>()) .add(new int[]{timestamp++, tweetId}); }
public List<Integer> getNewsFeed(int userId) { PriorityQueue<int[]> pq = new PriorityQueue<>((a, b) -> b[0] - a[0]);
Set<Integer> users = following.getOrDefault(userId, new HashSet<>()); users.add(userId);
for (int user : users) { List<int[]> userTweets = tweets.get(user); if (userTweets != null) { for (int[] tweet : userTweets) { pq.offer(tweet); } } }
List<Integer> result = new ArrayList<>(); int count = 0; while (!pq.isEmpty() && count < 10) { result.add(pq.poll()[1]); count++; } return result; }
public void follow(int followerId, int followeeId) { following.computeIfAbsent(followerId, k -> new HashSet<>()).add(followeeId); }
public void unfollow(int followerId, int followeeId) { if (following.containsKey(followerId)) { following.get(followerId).remove(followeeId); } }}Problem: Design stack that supports push, pop, top, and getMin in O(1).
Solution (Java):
class MinStack { private Stack<Integer> stack; private Stack<Integer> minStack;
public MinStack() { stack = new Stack<>(); minStack = new Stack<>(); }
public void push(int val) { stack.push(val); if (minStack.isEmpty() || val <= minStack.peek()) { minStack.push(val); } }
public void pop() { if (stack.pop().equals(minStack.peek())) { minStack.pop(); } }
public int top() { return stack.peek(); }
public int getMin() { return minStack.peek(); }}Time Complexity: O(1) for all | Space Complexity: O(n)
E-commerce domain
System Design thinking
Time management
Common patterns