# Flipkart Interview | Set 8 (For SDE 1)

Applied through LinkedIn

**Online Coding Round (Interviewstreet)**One of the many ways of representing a tree is to have an array(of length same as a number of nodes), where each element in the node denotes the parent of that node.

Please note –- An element with parent = -1 is the root element.
- An element with the least index becomes the leftmost child. (ie. a node with always be on the left of all its siblings that have a higher index than it)
- When printing a level of tree you need to maintain left to right order.

Eg –

{-1, 0, 0, 1, 1} would represent a tree with - * 0 as root * 1 and 2 as children of 0 * 3 and 4 as children of 1

Given a similar representation, you have to print reverse level order traversal of the corresponding tree.

Level order traversal of a tree is where we traverse levels of a tree one by one.Eg –

For the above-given tree, level order traversal would be –0 1 2 3 4

And hence, the reverse level order traversal is –

3 4 1 2 0

**Telephonic Round 1**- Find the square root of a given integer. e.g 27 output should be 5, for 32 output should be 6.
- Given a 2D matrix of integers find the maximum sum path in the matrix.

**Telephonic Round 2**- Given a number n, find the largest number small than having the same digits as of n. E.g. 231 output will be 213.
- Given a long stream of numbers find the largest k numbers at any given point.(I told him I know the question and told the solution, he moved on).
- Given k arrays of sorted integers, find the minimum range which contains the number from each of the k arrays.

e.g. {-1,4,7},{5,9,15,23},{8,24,25,31} output should be 2 range of {7,8,9} - Given a binary tree find all the nodes at k distance from a given node.

**F2F-R1 Machine Coding Round**- Create an employee database structure in which Employee has id, name, manager. Three functionalities required were

a) Given any id return all the employee details

b) Given any name(or id) list all the subordinates of the given employee.

c) Given a name search with prefix search property.45 minutes of time was given and running code was asked. The interviewer first asked the approach and then after coding, he reviewed the code thoroughly.

- Create an employee database structure in which Employee has id, name, manager. Three functionalities required were
**F2F-R2 Data Structure and Algorithm**- Given a list of words and a 2D matrix(of characters) find all the valid words(present in the given list) which are possible inside the given matrix.

Words can be formed in all 8 directions from a given cell.

The first discussion about the approach and then implementation of the logic. - Given a binary tree serialize the tree such that it can be retrieved in the same form again.
- Given a double linked list with one pointer pointing to the next node and the other pointer to any arbitrary node in the list, duplicate the given linked list.

**F2F-R3 Hiring Manager**- Introduction about the organization and the work being done.
- My introduction and the work is done by me.
- Asked some of the new ideas ( wow!!!!! features ) which can be implemented in the smartphone.
- Few other general questions.

**F2F-R4 Design Round**- Design the Tic-Toe game for a smart phone. Discussion about the class diagrams, structure of the code, code flow, abstraction of code and functionalities.
- Interviewer asked the approach to implement the above in android.
- Various android questions.

**F2F-R5 Hiring Manger + Reporting Manager**Hiring manager was on leave so this happened after a gap of one month after R4.

- Introduction about work.
- I asked various questions about work and my role.
- Design a mobile cab booking application (just screens and functionalities) on board. Asked questions about the things which I missed during the design.

And what all requirements are needed to before the application goes in development phase.

- Given a list of words and a 2D matrix(of characters) find all the valid words(present in the given list) which are possible inside the given matrix.

**Response was positive from the recruiter side.**

Thanks to all the contributors of GeeksforGeeks for bringing up this helpful platform for us. Hope to contribute further.

Many many congratulations to the author. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer **Complete Interview Preparation Course****. **In case you are prepared, test your skills using **TCS**, **Wipro**, **Amazon** and **Microsoft** Test Serieses.