dsa · easy

Merge Two Sorted Arrays

GreyOrangeArrayTwo PointersSortingFoundation

Merge sorted arrays a and b into one sorted array.

Arguments

**Example:** a=[1,2,3], b=[2,5,6][1,2,2,3,5,6].

Constraints

0 <= a.length, b.length <= 4*10^4 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
[1,2,3]
[2,5,6]

Expected:
[1,2,2,3,5,6]

Example 2

Input:
[]
[1]

Expected:
[1]

Open in the Dojo editor