← back to unit
Medium
# queues medium
The Zipper Merge
Two lines squeeze through one door, taking perfect turns: one from line A, one from line B, repeat. 🚪
You get line a and line b (front first, A goes first). When one line runs dry, the other files through. Print the door order, comma-separated.
Example:
Input: a = ["mia", "kai", "bo"], b = ["leo", "ana"]
Output: mia,leo,kai,ana,bo
Alternating fronts gives mia (A), leo (B), kai (A), ana (B) — then B is empty, so bo, still left in A, files through alone.
💡 need a hint?
q-zipper-merge.py🔒 given lines are locked — write your code in between
loading...