# Flipkart Interview | Set 11

Checking your coding capabilities and thinking level is their main motive. Hence the whole procedure I was involved in dealt only with coding questions. π

There were total 4 Rounds.

- Online Coding

- Machine Coding

- Face to face Technical Interview

- Technical + HR

**Round 1 : Online Coding :**

Time: 1 hour 30 Min**Powers of 5**

Cutting Binary String

**Application of DFS/BFS**

You were given a directed graph with n nodes. Given graph was connected. If there is an edge from u to v then u depends on v. Our task was to find out the sum of dependencies for every node.

- Example:

For the graph in diagram, A dependencies: C,D i.e. 2

B dependencies: D i.e. 1

C dependencies: D i.e. 1

And D depends on none.

Hence answer=0+1+1+2=4.

**Round 2: Machine Coding Round**

Time: 1 hour 30 min- Given two very large numbers a & b in string format. You need to produce the result for the following operation:

0: Add a & b

1: Subtract a & b

2: Multiply a & b

Example:

123456789

987654321

Output:

0 β 1111111110

1 β -864197532

2 β 1219326313718945259

Few cases were checked specifically:- Output of 132-132 must be 0 not 000.

- 2 β 122222000002 should produce -122222000000 i.e either a or b can be the bigger string.

- Negative input should be handled. Result of -2+202 = 200.

- 1000000000 β 1 = 999999999 i.e. resulting answer can be of different length.

- Output of 132-132 must be 0 not 000.

- Given two very large numbers a & b in string format. You need to produce the result for the following operation:
**Round 3: Face to face technical Interview**

Time: 45-50 minutes.

- Given a N find out the number of numbers possible of given length. It was asked to write the code.

Example:

For N=2

Possible numbers: 00,08 11,12,14 22,21,23,25 and so on. We have to print the count of such numbers.

I solved it using DP in the first attempt. He was quite impressed as I took very less time to think of the exact solution.

- Given an undirected graph with the following special points:
- Every node has at most 3 links.

- Node with a single link is a leaf node.

- Nodes are numbered from 1 to N.

- Every node has at most 3 links.
**Round 4 : Technical + HR**

Time: 1 Hour- Introduction.

- Asked everything about my project every minute detail, even I was asked to write code for a few sections of my code i.e. how I implemented those features.

- Asked few questions on teamwork that how would I handle particular situations.

- Strengths and weaknesses.

- Tell me about one thing that you have done in college and proud of being it in academics or in any field.

- Best and worst classmate till now and Why !! π

With this as the final interview, my long journey of Interviews ended :). Wish you all, all the very best hope this would help π

- Introduction.
**Following are round 1 online coding questions.****Summing Nodes (Programming)**

At Flipkart, an employee has many subordinates. But an employee can also have many managers. And a manager can further have more managers overseeing his work.

A simple “boss-employee-relationship” can be denoted by an arrow ‘β>’

A β B β C

This denotes that A is the direct boss of B, who is the direct boss of C. Here A is also the (indirect) boss of C. It is guaranteed that there is no cycles in this relationship.

That is there exists no pair of employees, X and Y, such that X is boss of Y and Y is also boss of X.

The salary of an employee can be calculated on the basis of the following rules:- an employee like C who has no subordinates earns 1.

- An employee who has direct subordinates earns a salary equal to the sum of his direct subordinates’ salaries.
- The size of relations array will not have elements greater than 50.

- the arrays will only contain string composed of ‘Y’ & ‘N’.

- each element of the array has the same number of characters.

- For kth row, the kth element will always be ‘N’.

- If X is boss of Y, Y cannot be a boss of X.

- Test cases are designed such that answers will always lie within the range of a signed 32-bit int.

- an employee like C who has no subordinates earns 1.
- The future is not always what we expect it to be. 60 years ago, we never thought that the world of humans, as we know it, will undergo such a drastic change. In the final war between the humans and the apes, the apes won, and Ceaser leads his civilization to its zenith,” a fellow human prisoner tells another.

“Now some of them have even learnt mathematics and are trying their best to re-create human machines from ruins. They have asked me to help them start a power generator, or else they’ll have no reason to keep me alive.”

To start it, a puzzle has to be solved:

You have to complete a function int optimalCuts(string s), where s is a string containing 0’s and l’s. It has to return the smallest positive integer C, such that, the bit string can be cut into C pieces and each piece is a power of 5. Note that each piece can also represent different power of 5. If no such cut is possible then return -1.**Constraints**- Argument (Strings) s) will consists of only ‘0’ and ‘1’.

- 1 <= length(s) <= 50.

- Argument (Strings) s) will consists of only ‘0’ and ‘1’.

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