Challenge 2: Merge Two Sorted Arrays
In this challenge, you are given two sorted arrays. Merge them into one array, which should also be sorted.
We'll cover the following
Problem statement
Implement a function mergeArrays(int arr1[], int arr2[], int arr1Size,int arr2Size)
which merges two sorted arrays into another sorted array.
Input
Two sorted arrays and their sizes are given.
Output
The output is a merged sorted array consisting of all elements of both input arrays.
Sample input
arr1 = [1,3,4,5]
arr2 = [2,6,7,8]
Sample output
arr = [1,2,3,4,5,6,7,8]
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.