Mid From PDF Coding Scenarios C# Coding Interview

Merge two sorted arrays?

int[] a = { 1, 3, 5 };
int[] b = { 2, 4, 6 };
int i = 0, j = 0;
List<int> result = new List<int>();

while (i < a.Length && j < b.Length)

result.Add(a[i] < b[j] ? a[i++] : b[j++]);

while (i < a.Length) result.Add(a[i++]);

while (j < b.Length) result.Add(b[j++]);

More from C# Programming Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details