## Flipkart Interview Question for Software Engineer / Developers

Comment hidden because of low score. Click to expand.
1
of 1 vote

What is the expected output?

Comment hidden because of low score. Click to expand.
1
of 1 vote

What is the input/output and the problem ?

Comment hidden because of low score. Click to expand.
0
of 0 vote

Bi-partite graph

Comment hidden because of low score. Click to expand.
0
of 0 vote

Cant we use two dimensional bit array?

Comment hidden because of low score. Click to expand.
0
of 0 vote

// basically a node(Person) having his name and an array of pointers pointing to the Person object of other group if it has punched that guy. So basically a graph.

Person{
String Name;

Person punchedPerson[];

}

Comment hidden because of low score. Click to expand.
0

The person nodes of 1 group could be arranged as an array or linked list. I personally would prefer as an array since the application might require accessing any person at a time.

Comment hidden because of low score. Click to expand.
0
of 0 vote

For in put we can use matrix and for the output it will be best if use graph.

Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Traverse the whole list once and find the number of participants, say n.
{A1,A2,A3,...An}
2. Create an array of n elements; initially all the values are 0. Each array element represents Ai.
3. For the first person, say A1. put Array[1] =1.
4. While any of the array element is 0, follow steps 5,6 and 7.
5. If 'Ai punches Aj' , and exactly one of(Array[i],Array[j]) is Not 0
then both are in different groups. So modify the array value accordingly.
like, A1 punches A4, and Array[1] is 1 and Array[4] is 0 then put -1 for Array[4].
6. Else if Ai value and Aj value are 0, continue.
7. if Ai and Aj are same (both 1 or both -1) then the INPUT IS WRONG. Return.
8. Print all A[i] which are 1, as First group. All a[i] which are -1 are second group.

Comment hidden because of low score. Click to expand.
0
of 0 vote

stack

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.