- Merge Two Sorted Arrays
Merge two given sorted ascending integer array A and B into a new sorted integer array.
Example Example 1:
Input: A=[1], B=[1] Output: [1,1] Explanation: return array merged. Example 2:
Input: A=[1,2,3,4], B=[2,4,5,6] Output: [1,2,2,3,4,4,5,6] Explanation: return array merged. Challenge How can you optimize your algorithm if one array is very large and the other is very small?