## Microsoft Interview Question Software Engineer / Developers

• 0

Remove intersections of two single linked list and make one linked list. operations should be recursive.

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

intersections?? there can be at max one intersection
first task is to remove the intersection, this should be non-recursive part(count nodes in both the list, move by the difference in the longer list and move parallel an check if pNode->next is same for both the lists. The moment it is found, make the next of shorter list NULL. Now there are two lists that need to be merged recursively.

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

Say the longer list intersects the shorter list at node x. Now, to form a single list just make next of x to head of shorter list.

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

I think Sarkar means "set of common elements" by "intersection".

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

Yes ,They meant the common elements only! :)

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

Are the lists sorted?

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

1. Sort the lists

``````Pseudocode:
RemoveIntersection(*list 1, *list 2, **list3)
{
continue this loop till either of the list becomes NULL and after that simply append the nodes of the remaining list (non-empty list) to the new list (list3)
if(list1->value == list2->value)
{
newNode = list1->value
list1 = lis1->next
list2 = list2->next
}
else if(list1->value < list2->value)
{
newNode = list1->value
list1 = list1->next
}
else
{
newNode = list2->value
list2 = list2->next
}

if(*list3 == NULL)
*list3 = newNode;
else
*list3->next = newNode
}``````

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

MS IDC makes fool of people.
People have to come to office on weekends due to workload and do night outs, no work life balance. They pay 10-20% more make people labour.

Do take the feedback from employees before joining MS.

And work is junk, all junk wor from Redmond is transferred to IDC. Ask any team, whether they design, implement products or just do porting or maintenance or make tools.

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

This is not entirely true. I agree work life balance is screwed. Its more because the IDC managers want to show their US counterparts that they can chew more than they can bite. The other comment about shady work I donot agree completely. I agree most groups do useless work but some groups do cool work. So figure it out before joining.

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

Stop posting your nonsense next to every question.
I have many friends in MS- India and they could not be happier with the work that they do ?
If you are so unhappy about your work then why dont you quit and end your misery ?

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

@Anonymous U r a Big Mother Fucker

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

what actually intersection of LL means?
does it happens at the last node only?

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

I didnt get the question.what exactly you mean...if linklist are sorted then intersection can be removed but in case of not knowing the previous element before intersection point how can you merge these two.?

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

maaaooooo

Name:

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

### Books

is a comprehensive book walking you through every aspect of getting a job at a top tech company, while focuses on software engineering interviews.

### 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.