Microsoft Interview Question for Software Engineer in Tests


Country: United States
Interview Type: In-Person




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

Assuming arr1 has space for m+n elements, but contains only m elements and arr2 for n elements.

Take two pointers pointing on end of both arrays data, call it rdIndex1 and rdIndex2, and one pointer pointing on absolute end of arr1, calling it wrIndex

Now whichever of arr1[rdIndex1] arr2[rdIndex2] is larger write it at arr1[wrIndex], and decrement corresponding rdIndex and wrIndex.
continue till both of rdIndex become zero.

- Anonymous January 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Array1 = M+N space and M elements
Array2 = N element
Shift all elements of Array1 to right such that Array[M+N]=Array[M]..... Array[N+i]=Array[i]... Array[N+1]=Array[1]

Now point Array1 at N+1 and Array2 at 1
compare Array1[N+1] and Array2[1]
whichever is greater put it at Array[1]
and increment correspondingly and so on....merge

- JINESH July 25, 2012 | 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