# Flipkart Interview Questions : set 4

By | May 2, 2014

It’s a general set of interview questions.Where we have aggregated various questions asked in Flipkart interviews to the candidates.We advice you to go through all these questions at least once .If you have an interview with flipkart.

Here are the question:

1. Find the lexicographic rank of a given permutation of a string.
2. Implement a phone book. You can search either by name or phone number. You can search by prefix also. Write whole code with proper syntax.
3. How would you find out all the books purchased in a city(Bangalore) on a given day.
4. Given a large list of numbers in a file and a very small amount of memory, sort the file.
5. How you will store a binary tree in a text file? Write algorithms to store the tree and retrieve it back.
6. Given an array with integers 0,1,2 sort the array by swapping elements.
7. Given a binary tree and a node, find the depth of the node.
8. Given a binary tree print every possible path that sums up to k (Not from root to leaf or any node to leaf. But from any node to any node including a node and its left and right branches)
9. Given integer number n, Print all valid parentheses for n=3 i.e. matching sets of 3 open brackets and 3 closed brackets.
10. Write an algorithm for partial key hashing. i.e; if Flipkart is inserted in the hash then searching for any of the sub strings should return the value stored
11. Given a sorted array with duplicates but rotated at certain point (6 7 8 1 2 3 4 5) how would you search for an element.
12. Given an array S of n integers, find if there are elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
13. Given an array with huge number of elements. Following two operations can be performed on the array at any timei)Find cumulative sum of first x numbers when x is input by user
ii) Add/subtract value ‘t’ from any index i of the array.
Find the most optimal way such that both the above requirements are optimized.
14. You are given 2 dice. Both are fair. One of the dice has no numbers printed on it. You have to label the unmarked dice such that when both the dice are thrown, the sum on the faces is evenly distributed between 1 and 12.
15. Given a board of snakes and ladders game, provide an algorithm to find the minimum number of dice rolls required to reach 100 from 1.
16. Suppose you have given a 2D array having filled with “L” or “W” i.e. either land or water, find its largest land unit in this grid, each cell of land is considered as 1 unit and you can only consider up,down,left or right land units as contiguous to each other not diagonal unit.
17. Given a number, compute the nearest palindrome number. This palindrome number should be greater than given number.
18. A group of persons is fighting on a road. We have details about who punched whom, and there are only two groups, and a person will punch only a person from another group. What data structure would you choose for the input, output and write a fully functioning program for this.
19. Following is a treeA
/ \
B C
/ \ / \
D E F G
/\ /
H I J

You need to print
A CB DEFG JIH

20. You are given a file containing integers in the range (1 to 1 million). There are some duplicates and hence some numbers are missing. Find the fastest way of finding missing numbers.
21. Write a method in java which takes argument as text string and array of token strings and find number of occurrences for each of the tokens in text string.
22. Given 3 product categories and a respective file of a huge size containing only the list of order numbers in sorted manner. Write an algorithm which can find common order numbers in all 3 files.
23. 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 some other color his money is doubled. Arrange the balls in such a way that the user has highest probability to lose.
24. Given a binary tree and a pointer to some node in the tree, find the left and right neighbors of the input node. The neighbor nodes are on the same level/depth as of input node.

Have got some interview questions submit it here.So that we can help other candidates like you to land their dream job