In order to win the prize for most cookies sold, my friend Alice and I are going to merge our Girl Scout Cookies orders and enter as one unit. Each order is represented by an "order id" (an integer).
We have our lists of orders sorted numerically already, in arrays. Write a function to merge our arrays of orders into one sorted array.
My solution completes the merge in O(n)
time, and O(n)
space, where n
represents the total number of elements from both input arrays.
- JavaScript