Microsoft Interview Question
Country: United States
Interview Type: In-Person
public static int[] merge(int[] a, int[] b, int n, int m)
{
int i = n - 1;
int j = m - 1;
int k = n+m - 1;
while (i>= 0 && j >= 0)
{
if (a[i] >= b[j])
{
a[k] = a[i];
i--;
k--;
}
else
{
a[k] = b[j];
k--;
j--;
}
}
return a;
}
- Shubham September 20, 2012