Merge Two Sorted Lists
easypy_basicsImplement merge_iterative(lst_a, lst_b).
Both inputs are sorted in non-decreasing order. Return one merged sorted list —
the classic merge step of merge sort, done by hand. Leave the inputs
unchanged. For example merge_iterative([1, 3], [2, 4]) == [1, 2, 3, 4].
sorted and slicing (seq[a:b]) are not allowed — use two pointers,
O(len(a) + len(b)).
Constraints
- no sorted
Your solution
Edit merge_iterative and run the real pytest suite in your browser — no install required. Your code is saved locally.
Loading the Python runtime (first run only)…
Hints
Hint 1
Two pointers i, j: append the smaller of lst_a[i] / lst_b[j], advance that pointer.
Hint 2
When one list is exhausted, drain the other with a plain loop (no slicing).