Microsoft Interview Question for Software Engineer / Developers






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.

- nutcraker May 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

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.

- smile March 15, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Anonymous May 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes ,They meant the common elements only! :)

- Sambit June 07, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Are the lists sorted?

- Agent June 07, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

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
}

- Anonymous June 17, 2010 | Flag
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.

- Anonymous June 03, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

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.

- Anonymous June 05, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

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 ?

- abhimanipal June 09, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Anonymous U r a Big Mother Fucker

- kna June 11, 2010 | Flag Reply
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?

- NooB August 27, 2010 | Flag Reply
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.?

- ashish.cooldude007 August 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

maaaooooo

- Anonymous August 30, 2010 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More