Alternate lane merge

Write codeEasy11 min

Your task

Two checkout lanes feed a single packing desk, which alternates between them: one order from lane A, one from lane B, and so on, starting with lane A. When one lane runs out, the desk takes the rest from the other lane in order. Given the two lanes' order numbers, return the sequence the desk processes. Example: A = [1, 3, 5] and B = [2, 4] give [1, 2, 3, 4, 5].

Examples

interleave_lanes(a: list[int], b: list[int]) -> list[int]
Example 1
Inputinterleave_lanes([1, 3, 5], [2, 4])
Output[1, 2, 3, 4, 5]