Merge Two Sorted Lists
Medium · Algorithms
Two sorted lists can be merged in one pass with two pointers: compare the current items of both lists, take the smaller one, and move that pointer forward. When one list runs out, the rest of the other list is already in order.
Write merge_sorted(a, b) that returns one sorted list with all items from a and b (both sorted ascending). Keep duplicates. Do not call sorted() or .sort().
Next: Binary Search