Given two sorted vectors of integers, merge them into one sorted vector containing all numbers
Example:
Input: first =[1, 4, 8],
second = [1, 3, 4, 17]
Output: [1, 1, 3, 4, 4, 8, 17]
Note:
Your algorithm should run in O(n + m) time and use O(n + m) extra space, where n and m are the lengths of the two vectors.
Walkthroughs of the solution. Try the steps first, then watch to compare approaches.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
