Microsoft Interview Question for Software Engineer in Tests






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

what do you mean by "add two lists"?

- S October 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

"add two list" means concatenate them?

- Anonymous October 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We can implement this recursively by adding node by node of two link list.
Where:
result=(node1+node2+earlier carry)%10
if((node1+node2)>10) then carry a 1 to the next addition.

Add the tails of the two nodes with passing along with carry.

Expample : List1 : 4->5->6 and List 2 : 4->5->2
Then result = 8->0->9

- Sidhartha November 05, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

wt abt "2->3->4->5->6->7" + "1->5->9"
Simple recursion will fail here..

- PKT February 05, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

if by add you mean concatenate them, there are at least 4 separate cases you should test:

- 2 non-empty lists
- 1 non-empty list, 1 empty list, in both possible ordering
- 2 empty lists

depending on what your specifications are, you may also want to test things like whether or not the program deals with circularly linked lists, etc. but of course, ask your interviewer what your arguments will be

- Anonymous November 06, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I believe by add means add two number represents using link list , if that the case reverse both the link list than start add node by node value from start node and insert in new link list after the addition reverse the resultant link list..

- Coder November 11, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

There is no need to reverse the resultant. I mean resultant can be constructed by adding nodes in reverse way.
For example:
head points to resultant linked list and temp is the node created after adding two digits then we can write:
temp->next = head;
head = temp;

- Nitin January 22, 2011 | Flag


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