Question: Merge 2 arrays in 1 array You are given a function mergeArrays which takes in two sorted arrays a and b as parameters. The first
Merge arrays in array
You are given a function mergeArrays which takes in two sorted arrays a and as parameters. The first array has elements in it The second one also has elements, but it's capacity is The function mergeArrays takes both the arrays as parameters along with Merge the first array into the second array such that the resulting array is sorted. The code to handle input and output in the format required by the test case files is already present in the system. There is no need to edit that part of the program.
Your task is to complete the body of mergeArrays with the signature provided, and to return the correct output.
Constraints
Sample Input:
Sample Output:
Explanation:
As stated in the question, the second array contains enough space to accommodate the st array. Return the merged sorted array.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
