6. Merge Two Sorted Arrays
easyarraytwo pointers
Given two arrays a and b, each sorted in non-decreasing order, return a single sorted array containing all elements of both.
Example 1
Inputa = [1,2,4], b = [1,3,4]
Output[1,1,2,3,4,4]
Example 2
Inputa = [], b = [0]
Output[0]
Example 3
Inputa = [5], b = []
Output[5]
Constraints
- 0 ≤ a.length, b.length ≤ 10⁴