
Flipkart


500+ Flipkart Interview Questions and Answers
Q1. Strategy assignment: Assume that Flipkart owned E-kart Logistics was thinking of entering the 'courier' business and how you as a product manager would go about figuring this opportunity?
To assess the opportunity of entering the courier business, I would conduct market research, analyze competition, evaluate logistics capabilities, and develop a business plan.
Conduct market research to identify demand and potential customers
Analyze competition to understand market share and pricing strategies
Evaluate E-kart Logistics' logistics capabilities and infrastructure
Develop a business plan outlining the strategy, financial projections, and operational requirements
Con...read more
Q2. Search In Rotated Sorted Array Problem Statement
Given a sorted array of distinct integers that has been rotated clockwise by an unknown amount, you need to search for a specified integer in the array. For each...read more
Implement a search function to find a specified integer in a rotated sorted array.
Implement a binary search algorithm to find the target integer in the rotated sorted array.
Handle the cases where the target integer may lie in the left or right half of the array after rotation.
Keep track of the mid element and adjust the search space based on the rotation.
Return the index of the target integer if found, else return -1.
Q3. Missing Number Problem Statement
You are provided with an array named BINARYNUMS
consisting of N
unique strings. Each string represents an integer in binary, covering every integer from 0 to N except for one. Y...read more
Find the missing integer in binary form from an array of unique binary strings.
Iterate through the array of binary strings and convert each string to its decimal equivalent.
Calculate the sum of all integers from 0 to N using the formula (N * (N + 1)) / 2.
Subtract the sum of the integers represented by the binary strings from the total sum to find the missing integer.
Convert the missing integer to binary form and return it as a string without leading zeros.
Q4. if you have to make an E way Bill for a shipment, how will you make it and how would you recognize it?
To make an E way Bill for a shipment, you need to register on the E way Bill portal and provide necessary details.
Register on the E way Bill portal
Provide shipment details such as invoice number, date, quantity, etc.
Generate the E way Bill with a unique E way Bill number
Recognize the E way Bill by checking the E way Bill number and verifying the details
Q5. Smallest Window Problem Statement
Given two strings S
and X
containing random characters, the task is to find the smallest substring in S
which contains all the characters present in X
.
Input:
The first line co...read more
Find the smallest substring in S containing all characters in X.
Use a sliding window approach to find the smallest window in S containing all characters in X.
Keep track of the characters in X using a hashmap.
Slide the window to the right until all characters in X are found, then shrink the window from the left to find the smallest window.
Q6. Median of Subarrays of Specific Size
Given an integer array ARR
of size N
and a specified subarray size M
, calculate and return the median of all subarrays of size M
starting from the left of the array.
The med...read more
Calculate and return the median of all subarrays of a specified size in an integer array.
Iterate through the array and for each subarray of size M, calculate the median.
If the size of the subarray is even, take the average of the two middle numbers as the median.
Return the list of medians for all subarrays of size M.
Q7. Kth Smallest Element in an Unsorted Array
Given an unsorted array arr
of distinct integers and an integer k
, your task is to find the k-th
smallest element in the array.
Input:
The first line of input contains ...read more
Find the k-th smallest element in an unsorted array of distinct integers.
Sort the array and return the k-th element.
Use a priority queue or quickselect algorithm for efficient solution.
Handle edge cases like k being out of bounds or array being empty.
Q8. Given an array, how do you get the count of pairs that sum to even
Count the number of pairs in an array that sum to an even number.
Iterate through the array and check each pair of elements.
If the sum of the pair is divisible by 2, increment the count.
Return the count of pairs that sum to an even number.
Q9. If you have 100 unbiased coins and one of them is defective. You have a weighing balance to check the weight of the coins. What is the minimum number of times you need to weigh the coins to identify the defecti...
read moreThe minimum number of times you need to weigh the coins is 4.
Divide the 100 coins into 3 groups of 33, 33, and 34 coins.
Weigh the first two groups against each other.
If they balance, the defective coin is in the third group.
If they don't balance, the defective coin is in the lighter group.
Divide the lighter group into 11 coins and weigh any 2 groups of 3 coins against each other.
If they balance, the defective coin is one of the remaining 5 coins.
If they don't balance, the def...read more
Q10. What is the electric current? How is works ?
Electric current is the flow of electric charge through a conductor.
Electric current is measured in amperes (A).
It is caused by the movement of electrons.
The direction of current flow is from positive to negative.
Current can be either direct current (DC) or alternating current (AC).
Examples of conductors include copper wires and water with dissolved ions.
Q11. Counting Nodes in a Complete Binary Tree - Problem Statement
Given the root of a complete binary tree, calculate the total number of nodes in this tree.
A complete binary tree is defined as a binary tree in whi...read more
Count the total number of nodes in a complete binary tree given its root.
Traverse the tree in level order and count the nodes
Use a queue to keep track of nodes at each level
Check for null nodes represented as -1 in the input
Return the total count of nodes in the tree
Q12. What is skills matrix of Return center Department?
The skills matrix of Return center Department is a tool that outlines the required skills and competencies for each job position.
The skills matrix helps identify training needs and areas for improvement
It ensures that employees have the necessary skills to perform their job duties effectively
Examples of skills in the matrix may include data entry, inventory management, and customer service
The matrix may also include soft skills such as communication and teamwork
Regular update...read more
Maximum Path Sum Problem Statement
You are given an n-ary tree consisting of 'N' nodes. Your task is to determine the maximum sum of the path from the root to any leaf node.
Example:
Input:
For the given tree:
Find the maximum sum of the path from the root to any leaf node in an n-ary tree.
Traverse the tree from root to leaf nodes, keeping track of the sum along the path.
At each node, calculate the sum of the path from the root to that node and update the maximum sum found so far.
Consider using depth-first search (DFS) to traverse the tree efficiently.
Handle cases where nodes are absent (-1) by appropriately updating the path sum.
Return the maximum sum found for each test case.
Q14. Longest Substring Without Repeating Characters Problem Statement
Given a string S
of length L
, determine the length of the longest substring that contains no repeating characters.
Example:
Input:
"abacb"
Output...read more
Find the length of the longest substring without repeating characters in a given string.
Use a sliding window approach to keep track of the longest substring without repeating characters.
Use a hashmap to store the index of each character as it appears in the string.
Update the start index of the window when a repeating character is found.
Calculate the maximum length of the window as you iterate through the string.
Return the maximum length as the result.
Q15. Shortest Alternate Colored Path Problem
Given a directed graph consisting of 'N' nodes labeled from '0' to 'N-1'. Each edge in the graph is colored either 'red' or 'blue'. The graph may include self-edges and p...read more
The task is to compute the shortest path from node '0' to each node in a directed graph with alternating colored edges.
Create a graph using the given red and blue edges.
Use Breadth First Search (BFS) to find the shortest path from node '0' to each node with alternating colored edges.
If no such path exists, set the length to -1.
Return the array of shortest path lengths for each node.
Q16. Counting Sort Problem Statement
Ninja is learning about sorting algorithms, specifically those that do not rely on comparisons. Can you help Ninja implement the counting sort algorithm?
Example:
Input:
ARR = {-...read more
Implement counting sort algorithm to sort an array of integers without comparisons.
Count the frequency of each element in the input array.
Calculate the prefix sum of frequencies to determine the position of each element in the sorted array.
Build the sorted array based on the prefix sum.
Time complexity of counting sort is O(n+k), where n is the number of elements and k is the range of input.
Example: Input array {-2, 1, 2, -1, 0} will be sorted as {-2, -1, 0, 1, 2}.
Q17. How will you design a Product for an apartment complex where the apartment owners need to use certain club facilities like Gym, Garden, Book club etc?
Designing a product for apartment owners to access club facilities
Conduct a survey to understand the needs and preferences of apartment owners
Create a mobile app or web portal for easy booking and access to facilities
Implement a membership system to ensure fair usage of facilities
Offer incentives for frequent usage or referrals
Partner with local businesses to offer discounts or promotions to members
Q18. Reverse Linked List Problem Statement
Given a singly linked list of integers, return the head of the reversed linked list.
Example:
Initial linked list: 1 -> 2 -> 3 -> 4 -> NULL
Reversed linked list: 4 -> 3 -> 2...read more
Reverse a singly linked list of integers and return the head of the reversed linked list.
Iterate through the linked list and reverse the pointers to point to the previous node instead of the next node.
Use three pointers - prev, current, and next - to reverse the linked list in O(N) time and O(1) space complexity.
Update the head of the reversed linked list as the last node encountered during the reversal process.
Q19. Pythagorean Triplets Detection
Determine if an array contains a Pythagorean triplet by checking whether there are three integers x, y, and z such that x2 + y2 = z2 within the array.
Input:
The first line contai...read more
Detect if an array contains a Pythagorean triplet by checking if there are three integers x, y, and z such that x^2 + y^2 = z^2.
Iterate through all possible triplets of numbers in the array and check if they form a Pythagorean triplet.
Use a nested loop to generate all possible combinations of three numbers from the array.
Check if the sum of squares of two numbers is equal to the square of the third number for each triplet.
Return 'yes' if a Pythagorean triplet is found, otherw...read more
Q20. Validate BST Problem Statement
Given a binary tree with N
nodes, determine whether the tree is a Binary Search Tree (BST). If it is a BST, return true
; otherwise, return false
.
A binary search tree (BST) is a b...read more
Validate if a given binary tree is a Binary Search Tree (BST) or not.
Check if the left subtree of a node contains only nodes with data less than the node's data.
Check if the right subtree of a node contains only nodes with data greater than the node's data.
Recursively check if both the left and right subtrees are also binary search trees.
Q21. Phone Directory Search Directory
You are given a list/array of strings representing the contacts in a phone directory. The task is to perform a search based on a query string 'str' and return all contacts that ...read more
Implement a phone directory search feature to suggest contacts based on a query string prefix.
Iterate through the contact list to find contacts with the prefix matching the query string.
Display suggestions as the user types each character of the query.
Handle cases where no suggestions are found for a particular prefix by printing 'No suggestions found'.
Q22. Number of Islands Problem Statement
You are provided with a 2-dimensional matrix having N
rows and M
columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in this ma...read more
Count the number of islands in a 2D matrix of 1s and 0s.
Use Depth First Search (DFS) or Breadth First Search (BFS) to traverse the matrix and identify connected groups of 1s.
Maintain a visited array to keep track of visited cells to avoid revisiting them.
Increment the island count each time a new island is encountered.
Consider all eight possible directions for connectivity between cells.
Handle edge cases such as out of bounds indices and already visited cells.
Q23. Kth Ancestor in a Binary Tree
You are given an arbitrary binary tree consisting of N
nodes numbered from 1 to N
, an integer K
, and a node TARGET_NODE_VAL
from the tree. Your task is to find the Kth ancestor of ...read more
Find the Kth ancestor of a given node in a binary tree.
Traverse the tree to find the path from the target node to the root node.
Keep track of the ancestors in a list while traversing.
Return the Kth ancestor from the list, or -1 if it doesn't exist.
Q24. What to do when manpower is short due to any occasion or any weather conditions.
In case of short manpower due to any occasion or weather conditions, there are a few steps that can be taken.
Prioritize tasks and focus on essential operations
Consider outsourcing or hiring temporary staff
Cross-train existing employees to fill in gaps
Adjust work schedules or shift patterns
Utilize technology and automation to reduce workload
Communicate with clients or customers about potential delays or changes
Ensure employee safety and well-being in adverse weather conditions
Q25. Find the Middle of a Linked List
This problem requires you to return a pointer that references the middle node of a singly linked list.
Explanation:
If the number of elements in the linked list is odd, return t...read more
Return a pointer to the middle node of a singly linked list.
Traverse the linked list with two pointers, one moving twice as fast as the other.
When the fast pointer reaches the end, the slow pointer will be at the middle.
If the number of elements is even, return the second middle node.
Q26. K Closest Points to Origin Problem Statement
Your house is located at the origin (0,0) of a 2-D plane. There are N
neighbors living at different points on the plane. Your goal is to visit exactly K
neighbors wh...read more
Find the K closest points to the origin in a 2-D plane using Euclidean Distance.
Calculate the Euclidean Distance for each point from the origin
Sort the points based on their distances from the origin
Return the first K points as the closest neighbors
Q27. Add Two Numbers as Linked Lists
You are given two singly linked lists, where each list represents a positive number without any leading zeros.
Your task is to add these two numbers and return the sum as a linke...read more
Add two numbers represented as linked lists and return the sum as a linked list.
Traverse both linked lists simultaneously while adding corresponding nodes and carry over the sum if needed
Handle cases where one linked list is longer than the other by considering carry over
Create a new linked list to store the sum and return its head node
Q28. Maximum Sum Path from Leaf to Root
Given a binary tree with 'N' nodes, identify the path from a leaf node to the root node that has the maximum sum among all root-to-leaf paths.
Example:
All the possible root t...read more
Find the path from a leaf node to the root node with the maximum sum in a binary tree.
Traverse the binary tree from leaf to root, keeping track of the sum along each path.
Compare the sums of all root-to-leaf paths and find the path with the maximum sum.
Implement a recursive function to traverse the tree and calculate the sum of each path.
Q29. Find All Triplets with Zero Sum
Given an array Arr
consisting of N
integers, find all distinct triplets in the array that sum up to zero.
Explanation:
An array is said to have a triplet {Arr[i], Arr[j], Arr[k]}...read more
Find all distinct triplets in an array that sum up to zero.
Use a nested loop to iterate through all possible triplets in the array.
Sort the array to easily identify duplicates and skip them.
Check for triplets with sum zero and add them to the result list.
Q30. What do you understand by the name customer service
Customer service refers to the support and assistance provided to customers before, during, and after their purchase or interaction with a company.
Customer service involves addressing customer inquiries, concerns, and complaints.
It includes providing information about products or services, helping customers make purchasing decisions, and resolving issues.
Customer service can be provided through various channels such as phone, email, chat, or in-person.
Examples of customer ser...read more
Q31. How to handle Floor operation with huge absentism?
To handle floor operations with huge absenteeism, it is important to have a contingency plan in place.
Implement a robust attendance tracking system
Cross-train employees to handle multiple roles
Utilize temporary staff or agency workers
Prioritize tasks and redistribute workload
Communicate effectively with the team
Offer incentives for good attendance
Analyze absenteeism patterns and address underlying issues
Q32. Longest Decreasing Subsequence Problem Statement
Given an array/list of integers ARR
consisting of N
integers, your task is to determine the length of the longest decreasing subsequence.
Explanation:
A subseque...read more
Find the length of the longest decreasing subsequence in an array of integers.
Use dynamic programming to keep track of the length of the longest decreasing subsequence ending at each index.
Initialize an array to store the length of the longest decreasing subsequence for each element.
Iterate through the array and update the length of the longest decreasing subsequence for each element based on previous elements.
Return the maximum length of the longest decreasing subsequence fo...read more
Q33. 1) what is java's first name? 2) what is JSE? 3)what is meant by java full stack? Answers: 1) OAK. 2) Java standard edision. 3) Java full stack contains the front end and backend technologies,testing tools,vers...
read more1) OAK. 2) Java Standard Edition. 3) Java full stack includes front end, back end, testing tools, and version control.
Java's first name is OAK.
JSE stands for Java Standard Edition.
Java full stack refers to the combination of front end, back end, testing tools, and version control.
Front end technologies include HTML, CSS, and JavaScript.
Back end technologies include Java, Python, and Ruby.
Testing tools can include JUnit, Selenium, and TestNG.
Version control tools like Git and ...read more
Q34. Palindrome Partitioning Problem Statement
You are given a string S
. Your task is to partition S
such that every substring of the partition is a palindrome. Your objective is to return all possible palindrome pa...read more
Partition a string into palindromes and return all possible configurations.
Use backtracking to generate all possible palindrome partitions
Check if each substring is a palindrome before adding it to the partition
Return all valid partitions as an array of strings
Q35. Problem: Sort an Array of 0s, 1s, and 2s
Given an array/list ARR
consisting of integers where each element is either 0, 1, or 2, your task is to sort this array in increasing order.
Input:
The input starts with...read more
Sort an array of 0s, 1s, and 2s in increasing order.
Use a three-pointer approach to sort the array in a single pass.
Initialize three pointers for 0, 1, and 2 values and iterate through the array.
Swap elements based on the values encountered to achieve the sorted array.
Example: Input array [0, 2, 1, 1] should be sorted as [0, 1, 1, 2].
Q36. Flipkart charges a shipping charge if the order amount is less than Rs. 500. How do you avoid it if you have an item which is less than 500 yet you do not want to pay for shipping?
Add more items to the cart to reach the minimum order amount of Rs. 500 and avoid shipping charges.
Check for other items that you may need and add them to the cart
Look for items that are on sale or have discounts to reach the minimum order amount
Consider buying in bulk to save on shipping charges
Check if there are any promo codes or coupons available to waive off shipping charges
Q37. Binary Tree Cameras Problem Statement
Given a binary tree where each node can carry a camera that monitors its parent, itself, and its immediate children, determine the minimum number of cameras needed to monit...read more
The problem involves determining the minimum number of cameras needed to monitor all nodes in a binary tree.
Implement a function to solve the problem efficiently.
Consider the different cases where cameras can be placed to cover all nodes.
Use recursion to traverse the tree and place cameras strategically.
Optimize the solution to minimize the number of cameras needed.
Test the function with different test cases to ensure correctness.
Q38. Longest Palindromic Substring Problem Statement
You are provided with a string STR
of length N
. The goal is to identify the longest palindromic substring within this string. In cases where multiple palindromic ...read more
Given a string, find the longest palindromic substring with the smallest start index.
Iterate through the string and expand around each character to find palindromes
Keep track of the longest palindrome found and its starting index
Return the longest palindromic substring with the smallest start index
Q39. Problem: Min Steps to One
Your task is to determine and return the minimum number of steps required to reduce a given positive integer 'N' down to 1.
You can perform one of the following three steps:
1) Subtrac...read more
Find the minimum number of steps to reduce a positive integer to 1 using given operations.
Use dynamic programming to keep track of minimum steps for each number from 1 to N.
Consider all three possible operations for each number and choose the one with minimum steps.
Handle edge cases like when N is less than 1 or when N is not a positive integer.
Q40. Can you give me the total number of Tubelights in Bangalore?
It is impossible to give an accurate number without conducting a survey or having access to official data.
There is no centralized database or registry of tubelights in Bangalore.
The number of tubelights in Bangalore is constantly changing due to new installations and replacements.
The number of tubelights also varies depending on the type of building and its usage.
Without conducting a survey or having access to official data, it is impossible to give an accurate number.
Q41. Largest BST Subtree Problem Statement
You are given a binary tree with 'N' nodes. Your task is to determine the size of the largest subtree within the binary tree which is also a Binary Search Tree (BST).
Prope...read more
Find the size of the largest subtree in a binary tree that is also a Binary Search Tree.
Traverse the tree in a bottom-up manner to check if each subtree is a BST.
Keep track of the size of the largest BST subtree encountered so far.
Use recursion to solve this problem efficiently.
Example: For the input 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1, the largest BST subtree has a size of 3.
Q42. Detect Cycle in a Directed Graph
You are provided with a directed graph composed of 'N' nodes. You have a matrix called 'EDGES' with dimensions M x 2, which specifies the 'M' edges in the graph. Each edge is di...read more
Detect cycle in a directed graph using depth-first search (DFS) algorithm.
Use DFS to traverse the graph and detect back edges (edges that point to an ancestor node).
Maintain a visited array to keep track of visited nodes and a recursion stack to keep track of nodes in the current path.
If a back edge is found during traversal, a cycle exists in the graph.
Return true if a cycle is detected, false otherwise.
Q43. LRU Cache Design Question
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherwise, re...read more
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.
Use a combination of hashmap and doubly linked list to efficiently implement the LRU cache.
Keep track of the least recently used item and update it accordingly when inserting new items.
Ensure to handle the capacity constraint by evicting the least recently used item when the cache is full.
Implement get(key) and put(key, value) operations as per the specified r...read more
Q44. The Skyline Problem
Compute the skyline of given rectangular buildings in a 2D city, eliminating hidden lines and forming the outer contour of the silhouette when viewed from a distance. Each building is descri...read more
Compute the skyline of given rectangular buildings in a 2D city, eliminating hidden lines and forming the outer contour of the silhouette.
Iterate through the buildings and create a list of critical points (x, y) where the height changes.
Sort the critical points based on x-coordinate and process them to form the skyline.
Merge consecutive horizontal segments of equal height into one to ensure no duplicates.
Return the final list of key points representing the skyline.
Example: In...read more
Q45. Modify this code to find the maximum subtree in tree which is a BST. Maximum subtree means subtree goes upto its leaves from any node. Modify the code again to find the maximum tree which is a BST. BST can lie...
read moreModify code to find maximum BST subtree and maximum BST tree in a given tree.
Create a function to check if a given tree is a BST
Traverse the tree and check if each subtree is a BST
Keep track of the maximum BST subtree found so far
To find maximum BST tree, check if each node can be the root of a BST
Keep track of the maximum BST tree found so far
Q46. Circular Move Problem Statement
You have a robot currently positioned at the origin (0, 0) on a two-dimensional grid, facing the north direction. You are given a sequence of moves in the form of a string of len...read more
Determine if a robot's movement path is circular on a 2D grid given a sequence of moves.
Create a set of directions to keep track of the robot's movement (N, E, S, W).
Simulate the robot's movement based on the given sequence of moves.
Check if the robot returns to the starting position after completing the moves.
Q47. Find K-th Smallest Element in BST
Given a binary search tree (BST) and an integer K
, the task is to find the K-th smallest element in the BST.
Example:
Input:
BST: Order of elements in increasing order is { 2, ...read more
Find the K-th smallest element in a binary search tree (BST).
Perform an in-order traversal of the BST to get elements in increasing order.
Keep track of the count of visited nodes to find the K-th smallest element.
Return the K-th smallest element once the count matches K.
Q48. Minimum Steps for a Knight to Reach Target
Given a square chessboard of size 'N x N', determine the minimum number of moves a Knight requires to reach a specified target position from its initial position.
Expl...read more
Calculate minimum steps for a Knight to reach target position on a chessboard.
Use BFS algorithm to find shortest path from Knight's starting position to target position.
Consider all possible moves of the Knight on the chessboard.
Keep track of visited positions to avoid revisiting them.
Return the minimum number of moves required to reach the target position.
Q49. Print Nodes at Distance K from a Given Node
Given an arbitrary binary tree, a node of the tree, and an integer 'K', find all nodes that are at a distance K from the specified node, and return a list of these no...read more
Given a binary tree, a target node, and an integer K, find all nodes at distance K from the target node.
Traverse the binary tree to find the target node.
Use BFS to traverse the tree and find nodes at distance K from the target node.
Keep track of the distance of each node from the target node while traversing.
Return the values of nodes at distance K in any order.
Q50. Find the Longest Palindromic Substring
Given a string ‘S’ composed of lowercase English letters, your task is to identify the longest palindromic substring within ‘S’.
If there are multiple longest palindromic ...read more
Find the longest palindromic substring in a given string, returning the rightmost one if multiple exist.
Use dynamic programming to check for palindromes within the string.
Start by checking for palindromes of length 1 and 2, then expand to longer substrings.
Keep track of the longest palindrome found and its starting index.
Return the substring starting from the index of the longest palindrome found.
Q51. Spell Checker Problem Statement
You are provided with a list of strings, DICTIONARY[]
, representing the correct spellings of words, and a query string QUERY
that may contain misspelled words. Your task is to ve...read more
Implement a spell checker function that suggests correct spellings from a dictionary for a given query string.
Iterate through the dictionary to check for matching prefixes with the query string.
Return a list of suggestions if the query string is misspelled, otherwise return an empty list.
Handle multiple test cases by looping through each case independently.
Q52. Trapping Rain Water Problem Statement
You are given a long type array/list ARR
of size N
, representing an elevation map. The value ARR[i]
denotes the elevation of the ith
bar. Your task is to determine the tota...read more
Calculate the total amount of rainwater that can be trapped between given elevations in an array.
Iterate through the array and calculate the maximum height on the left and right of each bar.
Calculate the amount of water that can be trapped at each bar by taking the minimum of the maximum heights on the left and right.
Sum up the trapped water at each bar to get the total trapped water for the entire array.
Q53. Next Permutation Problem Statement
You are given a permutation of 'N' integers. A sequence of 'N' integers is considered a permutation if it includes all integers from 1 to 'N' exactly once. Your task is to rea...read more
The task is to rearrange a given permutation of 'N' integers to form the lexicographically next greater permutation.
Iterate from right to left to find the first element that is smaller than the element to its right.
Swap this element with the smallest element to its right that is greater than it.
Reverse the elements to the right of the swapped element to get the lexicographically next greater permutation.
Q54. Print the Kth Digit
Given three non-negative integers N, M, and K, compute the Kth digit from the right in the number obtained from N raised to the power M (i.e., N ^ M).
Input:
The first line contains an integ...read more
The task is to find the Kth digit from the right in the number obtained from N raised to the power M.
Iterate through the digits of N^M from right to left
Keep track of the position of the current digit
Return the digit at position K from the right
Q55. There is code like var i; { .. var j; .. } var k; .. var a; { .. var c; { var i; } .. var d; .. } For simplicity you may assume that there is only one variable declaration on 1 line. Now given a line number, yo...
read moreAlgorithm to determine valid variables on a given line of code.
Create a stack to keep track of variable declarations
Traverse the code line by line
When encountering a variable declaration, push it onto the stack
When encountering a closing brace, pop all variables declared within that scope
Return all variables still on the stack when reaching the given line number
Q56. Remove All The Palindromes Problem Statement
Given a string STR
consisting only of lowercase letters, your task is to modify the string by replacing the minimum characters such that the string doesn’t contain a...read more
The task is to modify a string by replacing minimum characters to remove all palindromic substrings.
Identify palindromic substrings in the given string
Replace characters in the substrings to break the palindrome
Count the minimum number of characters replaced to remove all palindromic substrings
Q57. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
The task is to find the total number of ways to make change for a specified value using given denominations.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the number of ways to make change for each value up to the specified value.
Iterate through each denomination and update the array accordingly.
The final answer will be stored in the last cell of the array.
Example: For N=3, D=[1, 2, 3], V=4, the output is 4 as there are 4 ways to make cha...read more
Q58. Next Greater Element Problem Statement
Given a list of integers of size N
, your task is to determine the Next Greater Element (NGE) for every element. The Next Greater Element for an element X
is the first elem...read more
The task is to find the Next Greater Element for each element in a list of integers.
Iterate through the list of integers from right to left
Use a stack to keep track of elements for which the Next Greater Element is not found yet
Pop elements from the stack until a greater element is found or the stack is empty
Assign the Next Greater Element as the top element of the stack or -1 if the stack is empty
Q59. Container with Most Water Problem Statement
Given a sequence of 'N' space-separated non-negative integers A[1], A[2], ..., A[i], ..., A[n], where each number in the sequence represents the height of a line draw...read more
Find the maximum area of water that can be contained between any two lines on a plane.
Iterate through the array of heights using two pointers approach to find the maximum area.
Calculate the area using the formula: area = (min(height[left], height[right]) * (right - left)).
Move the pointer pointing to the smaller height towards the center to potentially find a larger area.
Q60. Input : 4 jars and 50 balls of different colors (Red, Green, Yellow, Blue) where each jar can contain a maximum of 100 balls.Problem : When a user draws a red ball he loses his money while if he draws a ball of...
read moreArrange balls in 4 jars to maximize probability of user losing money when drawing a red ball.
Place all red balls in one jar and the rest in the other jars
Ensure that the jar with red balls has the highest probability of being chosen
Randomize the placement of the jars to add an element of chance
Q61. Pattern Matching Problem Statement
Given a pattern as a string and a set of words, determine if the pattern and the words list align in the same sequence.
Input:
T (number of test cases)
For each test case:
patte...read more
Given a pattern and a list of words, determine if the words align with the pattern.
Iterate through the pattern and words list simultaneously to check for alignment.
Use a hashmap to store the mapping between characters in the pattern and words.
Return 'True' if the mapping aligns with the order of characters in the pattern, else return 'False'.
Q62. Is Height Balanced Binary Tree Problem Statement
Determine if the given binary tree is height-balanced. A tree is considered height-balanced when:
- The left subtree is balanced.
- The right subtree is balanced.
- T...read more
Determine if a given binary tree is height-balanced by checking if left and right subtrees are balanced and their height difference is at most 1.
Check if the left subtree is balanced
Check if the right subtree is balanced
Calculate the height difference between the left and right subtrees
Return 'True' if all conditions are met, otherwise return 'False'
Q63. Ceil Value from BST Problem Statement
Given a Binary Search Tree (BST) and an integer, write a function to return the ceil value of a particular key in the BST.
The ceil of an integer is defined as the smallest...read more
Ceil value of a key in a Binary Search Tree (BST) is found by returning the smallest integer greater than or equal to the given number.
Traverse the BST to find the closest value greater than or equal to the key.
Compare the key with the current node value and update the ceil value accordingly.
Recursively move to the left or right subtree based on the comparison.
Return the ceil value once the traversal is complete.
Q64. Design a Constant Time Data Structure
Create a data structure that maintains mappings between keys and values, supporting the following operations in constant time:
1. INSERT(key, value): Add or update the inte...read more
Design a constant time data structure to maintain mappings between keys and values with various operations.
Use a hash table to achieve constant time complexity for INSERT, DELETE, SEARCH, and GET operations.
Keep track of the number of key-value pairs for GET_SIZE operation.
Check if the hash table is empty for IS_EMPTY operation.
Return true or false for SEARCH operation based on key existence.
Return the value associated with the key for GET operation, or -1 if not found.
Q65. What is ms office? What is vlookup?
MS Office is a suite of productivity software. VLOOKUP is a function in Excel used to search for data in a table.
MS Office includes programs like Word, Excel, PowerPoint, and Outlook.
VLOOKUP stands for 'vertical lookup' and is used to find specific data in a table.
It is commonly used in Excel for tasks like matching data from different sheets or tables.
The function requires four arguments: the value to look up, the table to search, the column to return data from, and whether ...read more
Q66. How would you measure the success of Google search results?
Success of Google search results can be measured through various metrics.
Click-through rate (CTR) of top results
Time spent on search results page
Number of searches per user session
Bounce rate of search results page
User satisfaction surveys
Number of repeat searches
Conversion rate of search results
Accuracy of search results
Number of search result pages viewed per session
Q67. K-th Largest Number in a BST
Given a binary search tree (BST) consisting of integers and containing 'N' nodes, your task is to find and return the K-th largest element in this BST.
If there is no K-th largest e...read more
Find the K-th largest element in a BST.
Perform reverse in-order traversal of the BST to find the K-th largest element.
Keep track of the count of visited nodes to determine the K-th largest element.
Return -1 if there is no K-th largest element in the BST.
Q68. Problem: Search In Rotated Sorted Array
Given a sorted array that has been rotated clockwise by an unknown amount, you need to answer Q
queries. Each query is represented by an integer Q[i]
, and you must determ...read more
Search for integers in a rotated sorted array efficiently.
Use binary search to efficiently search for integers in the rotated sorted array.
Handle the rotation of the array while performing binary search.
Return the index of the integer if found, else return -1.
Q69. Count Subarrays with Sum Divisible by K
Given an array ARR
and an integer K
, your task is to count all subarrays whose sum is divisible by the given integer K
.
Input:
The first line of input contains an integer...read more
Count subarrays with sum divisible by K in an array.
Iterate through the array and keep track of the prefix sum modulo K.
Use a hashmap to store the frequency of each prefix sum modulo K.
For each prefix sum, increment the count by the frequency of (prefix sum - K) modulo K.
Handle the case when prefix sum itself is divisible by K.
Return the total count of subarrays with sum divisible by K.
Q70. How is online business better than offline?
Online business offers greater reach, convenience, cost-effectiveness, and scalability compared to offline business.
Greater reach: Online business allows you to reach a global audience, breaking geographical barriers.
Convenience: Customers can shop anytime, anywhere, without the need to visit a physical store.
Cost-effectiveness: Online businesses often have lower overhead costs, no need for physical retail space, and can leverage digital marketing strategies.
Scalability: Onli...read more
Q71. How do you make 720 with 6 zeroes using mathematical operators?
To make 720 with 6 zeroes, multiply 6! by 1000.
Calculate the factorial of 6 (6! = 6 x 5 x 4 x 3 x 2 x 1 = 720)
Multiply the result by 1000 (720 x 1000 = 720000)
Alternatively, add three zeroes to the end of 720 (720000 = 720000)
Q72. How to maintain delivery boys.,& critical situations in hubs
To maintain delivery boys, provide incentives, clear communication, and a supportive work environment. In critical situations, have contingency plans in place.
Offer incentives such as bonuses or flexible schedules to keep delivery boys motivated and engaged.
Maintain clear communication channels to ensure that delivery boys are aware of their responsibilities and any changes in operations.
Create a supportive work environment by providing training, resources, and opportunities ...read more
Q73. Given an array, how do you get the count of pairs that sum to odd
Count the number of pairs in an array that sum to an odd number.
Iterate through the array and check each pair of elements.
Use a nested loop to compare each element with every other element.
Keep a count of pairs that sum to an odd number.
Q74. How would you give recommendations to Sellers on Flipkart?
I would give recommendations to sellers on Flipkart by analyzing their sales data, identifying areas of improvement, and suggesting strategies to increase sales.
Analyze sales data to identify top-selling products and categories
Suggest pricing strategies to increase sales and profitability
Recommend marketing and advertising campaigns to reach new customers
Provide feedback on product listings and descriptions to improve visibility and sales
Offer guidance on inventory management...read more
Q75. Given n sequences, and starting and stopping point of every sequence with its score. For eg. no of sequences = 5 start stop score 0 4 4 3 10 11 6 8 8 7 15 10 11 15 4 All scores are positive. You have to find th...
read moreGiven n sequences with start, stop and score, find maximum subset of non-overlapping sequences with maximum total score.
Sort the sequences by their end points.
Use dynamic programming to find the maximum sum of non-overlapping sequences.
Keep track of the previous non-overlapping sequence with maximum sum.
Return the maximum sum and the corresponding non-overlapping sequences.
Q76. what are the major transportation issues in warehousing?
Major transportation issues in warehousing include congestion, inefficient routing, and lack of visibility.
Congestion: Warehouses often face congestion due to limited space and high volume of incoming and outgoing shipments.
Inefficient routing: Poor planning and lack of optimized routes can lead to delays and increased transportation costs.
Lack of visibility: Without proper tracking and monitoring systems, it becomes difficult to have real-time visibility of shipments, result...read more
Q77. A car manufacturer has observed a decline in profits by 40% year over year. What would be the possible reasons for this?
Possible reasons for a car manufacturer's decline in profits by 40% year over year
Decreased demand for cars due to economic downturn
Increased competition from other car manufacturers
Rising production costs and expenses
Decline in consumer confidence and spending
Changes in government regulations impacting the automotive industry
Q78. In 1 day how many veh can be loaded and unloaded with dock man power count of 14.
The dock can load and unload approximately X number of vehicles in a day with 14 dock workers.
The number of vehicles that can be loaded and unloaded in a day depends on various factors such as the size of the vehicles, the type of goods being transported, and the efficiency of the dock workers.
Assuming an average of 30 minutes per vehicle, 14 dock workers can load and unload approximately 56 vehicles in an 8-hour shift.
However, this number can vary depending on the specific c...read more
Q79. What is customer service? Is the support you offer ur customer before and after buying ur product.
Customer service is the support provided to customers before and after purchasing a product or service.
Customer service involves assisting customers with their inquiries, concerns, and issues.
It includes providing information about products or services, helping customers make purchasing decisions, and resolving any problems they may encounter.
Customer service can be provided through various channels such as phone, email, chat, or in-person.
Examples of customer service include...read more
Q80. How would you determine the dip in GMV of Flipkart?
To determine dip in GMV of Flipkart, analyze sales data, customer feedback, and market trends.
Analyze sales data to identify any sudden drops or trends over time
Gather customer feedback to understand any issues or concerns affecting sales
Monitor market trends and competition to identify external factors impacting GMV
Consider any changes in pricing, promotions, or product offerings that may affect sales
Use data analysis tools and techniques to identify patterns and insights
Col...read more
Q81. Flipkart Big Billion day sale is ongoing and you are to be vigilant w.r.t scale issues. You see that the time to complete orders is increasing.
I would investigate the root cause of the increase in order completion time and take necessary actions to resolve the issue.
Check if there are any technical issues causing the delay
Analyze the traffic and order volume to ensure the infrastructure can handle the load
Collaborate with the engineering team to optimize the system performance
Communicate with the customer support team to manage customer expectations
Monitor the situation closely and take proactive measures to prevent...read more
Q82. What would you do to get sellers sign up quickly? Take certain baseline assumptions.
To get sellers sign up quickly, offer incentives, simplify the sign-up process, and provide clear benefits.
Offer sign-up bonuses or discounts to incentivize sellers
Simplify the sign-up process by reducing the number of steps and required information
Clearly communicate the benefits of signing up, such as increased visibility and sales potential
Provide excellent customer support to address any concerns or questions
Utilize social media and targeted advertising to reach potential...read more
Q83. Running Median Problem
Given a stream of integers, calculate and print the median after each new integer is added to the stream.
Output only the integer part of the median.
Example:
Input:
N = 5
Stream = [2, 3,...read more
Calculate and print the median after each new integer is added to the stream.
Use two heaps - a max heap to store the smaller half of the numbers and a min heap to store the larger half.
Keep the sizes of the two heaps balanced to efficiently calculate the median.
If the total number of elements is odd, the median will be the top element of the max heap.
If the total number of elements is even, the median will be the average of the top elements of the two heaps.
The time complexity of retrieving the minimum element from a max heap is O(1).
Retrieving the minimum element from a max heap involves accessing the root node, which is always the minimum element in a max heap.
Since the root node can be directly accessed in constant time, the time complexity is O(1).
Q85. Visualize a Uber database of drivers and riders(users) and write a SQL query to get the top 100 drivers by city.
SQL query to get top 100 Uber drivers by city
Join drivers and users tables on city
Aggregate driver ratings and count of rides
Order by rating and count of rides
Limit to top 100
Q86. Basic work flow of operation from IB(Inbound) to OB(Outbound)
The basic work flow of operations from inbound to outbound involves receiving, processing, and delivering goods or services.
Inbound operations involve receiving goods or services from suppliers or customers.
Goods or services are then processed, which may include sorting, inspecting, or assembling.
Outbound operations involve packaging, labeling, and delivering goods or services to customers.
Throughout the process, inventory management and quality control are essential.
Examples...read more
Q87. How do you optimize the listing of Restaurants on Swiggy?
Optimizing the listing of Restaurants on Swiggy involves using data-driven strategies to improve visibility, relevance, and user experience.
Analyze user behavior and preferences to understand their needs and preferences
Implement a ranking algorithm based on factors like ratings, reviews, popularity, and delivery time
Optimize search functionality to ensure accurate and relevant results
Collaborate with restaurants to improve their online presence and menu offerings
Leverage cust...read more
Q88. 1. How to increase inventory 2. Roster Management 3. Inventory Audit 4. How to manage stock discrepancy
Increasing inventory can be achieved through effective demand forecasting, optimizing storage space, and establishing strong supplier relationships.
Implement demand forecasting techniques to accurately predict future inventory needs
Optimize storage space by organizing inventory and utilizing vertical storage solutions
Establish strong relationships with suppliers to ensure timely and reliable delivery of inventory
Regularly review and update inventory levels based on sales tren...read more
Q89. if you are given a sorted array of size 7 but only 4 elements in it and a sorted array of 3 elements. How would to combine the elements into the first array in such a way that array is sorted
Combine 4 elements of a sorted array of size 7 and a sorted array of 3 elements to make a sorted array.
Insert the 3 elements of the smaller array into the larger array
Sort the larger array using any sorting algorithm
Q90. - what is supply chain? difference between logistics and transport?
Supply chain is the process of managing the flow of goods and services from the point of origin to the point of consumption.
Supply chain involves the coordination and integration of various activities such as procurement, production, transportation, warehousing, and distribution.
It includes the planning, execution, and control of the entire process to ensure the right products are delivered to the right place at the right time.
Logistics is a subset of supply chain management ...read more
Q91. - what will you do to double revenue of your organisation
To double revenue, I will focus on expanding our customer base and increasing sales through targeted marketing and strategic partnerships.
Identify target markets and create tailored marketing campaigns
Develop strategic partnerships with complementary businesses
Improve customer experience and satisfaction to increase retention and referrals
Explore new revenue streams and diversify product offerings
Analyze and optimize pricing strategies
Invest in employee training and developme...read more
Q92. How would you make e-commerce experience more social?
Introduce social media integration, personalized recommendations, user reviews and ratings.
Integrate social media platforms to allow users to share their purchases and reviews
Provide personalized recommendations based on user's social media activity and interests
Allow users to rate and review products, and interact with other users' reviews
Create a community forum for users to discuss products and share their experiences
Offer incentives for users to refer friends and family t...read more
Q93. What is excel ? How it is work ?
Excel is a spreadsheet program used for data analysis and organization.
Excel is a software application developed by Microsoft.
It is used for creating, editing, and analyzing data in a tabular format.
Excel uses cells, rows, and columns to organize and manipulate data.
It supports various mathematical and statistical functions for data analysis.
Excel can create charts, graphs, and pivot tables for visualizing data.
Formulas and functions can be used to perform calculations on dat...read more
Q94. Demand of TVs next year? Specify one 'good' and one 'bad' approach
The demand for TVs next year is uncertain. A good approach would be to conduct market research and analyze trends, while a bad approach would be to rely solely on intuition.
Good approach: Conduct market research to understand consumer preferences and trends
Good approach: Analyze past sales data and industry forecasts to predict demand
Bad approach: Rely solely on intuition or gut feeling without any data or research
Bad approach: Overestimate demand without considering market f...read more
Design a system for BookMyShow to allow users to book movie tickets.
Create a user-friendly website and mobile app for users to browse movies and showtimes.
Implement a secure payment gateway for users to purchase tickets online.
Develop a database to store movie information, showtimes, and user bookings.
Include features like seat selection, ticket confirmation, and booking history for users.
Integrate with cinema partners to update real-time availability and showtimes.
Q96. How would you rate yourself in excel usage?
I am highly proficient in Excel usage.
I have been using Excel for over 10 years and have advanced skills in data analysis, pivot tables, and macros.
I have created complex financial models and automated reporting processes using Excel.
I am constantly learning new Excel functions and shortcuts to improve my efficiency.
I have trained and mentored colleagues on Excel usage and best practices.
Q97. Given two string str and pat. Find minimum window in str which contains all characters from string pat
Find minimum window in a string which contains all characters from another string.
Use a sliding window approach
Create a frequency map of characters in pat
Iterate through str and update frequency map
Keep track of minimum window that contains all characters
Return minimum window
Q98. How many conditional statements are there? if, if else, else, switch
There are four conditional statements: if, if else, else, and switch.
The 'if' statement is used to execute a block of code if a certain condition is true.
The 'if else' statement is used to execute a block of code if a certain condition is true, and another block of code if it is false.
The 'else' statement is used to execute a block of code if the preceding 'if' or 'if else' condition is false.
The 'switch' statement is used to select one of many code blocks to be executed base...read more
Q99. How to control attrition rate, your 5 years goals, achiements and how you are ideal candidate for Flipkart
To control attrition rate, I plan to implement employee engagement programs and career growth opportunities. My 5-year goal is to reduce attrition by 50%. As an experienced operations leader, I have achieved a 20% reduction in attrition in my previous role and am confident in my ability to do the same at Flipkart.
Implement employee engagement programs
Provide career growth opportunities
Conduct regular employee feedback sessions
Offer competitive compensation and benefits
Create ...read more
Q100. What are the major differences between a Linear Regression and a Logistic Regression?
Linear Regression is used for continuous data while Logistic Regression is used for categorical data.
Linear Regression predicts continuous values while Logistic Regression predicts probabilities.
Linear Regression uses a straight line to fit the data while Logistic Regression uses an S-shaped curve.
Linear Regression uses Mean Squared Error as the cost function while Logistic Regression uses Log Loss.
Linear Regression is sensitive to outliers while Logistic Regression is robust...read more
More about working at Flipkart




Top HR Questions asked in Flipkart
Interview Process at Flipkart

Top Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

