**Problem Description**

Given two sorted arrays of integers **A** and **B**, sorted in ascending order.

Merge the two arrays **A** and **B** into a single array such that it contain all the elements from **A** and **B** and it remain sorted at the same time.

Find and return the resultant merged array.

1 <= Length of both the arrays <= 10^{5}

1 <= A[i], B[i] <= 10^{9}

The first argument given is the integer array **A**.

The second argument given is the integer array **B**.

Return a one-dimensional integer array denoting the resultant merged array.

Input 1:

A = [1, 3, 4] B = [2, 5, 6]

Input 2:

A = [2, 5] B = [1, 2, 3]

Output 1:

[1, 2, 3, 4, 5, 6]

Output 2:

[1, 2, 2, 3, 5]

Explanation 1:

On merging A and B together you get [1, 2, 3, 4, 5, 6]

Explanation 2:

On merging A and B together you get [1, 2, 2, 3, 5]

NOTE:You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.

Sign Up

to access hints and editorial solutions for**Merge Two Sorted Arrays**

to access hints and editorial solutions for

Loading...