Warm-ups · 12 of 24
Merge two sorted arrays
Given two sorted arrays, return one sorted array with all their elements.
Examples
Input a = [1, 3, 5], b = [2, 4, 6]
Output [1, 2, 3, 4, 5, 6]
Input a = [1, 2], b = []
Output [1, 2]
📘 New to this? Building a new string or array as the answer explains the idea in a few minutes.
Solved it? The same idea on LeetCode: try it there ↗