# queues medium

The Two Trucks

Two ice cream trucks, and every arriving kid joins the SHORTER line (truck 1 on a tie). 🍦🍦

You get the arrivals in order. Print truck 1's line, then truck 2's line (front to back, comma-separated, empty if bare).

Example:

Input: arrivals = ["mia", "leo", "kai", "ana", "bo"] Output:

mia,kai,bo
leo,ana

mia joins truck 1 (empty tie), leo joins truck 2 (now shorter), kai joins truck 1 (tied again), ana joins truck 2, and bo joins truck 1 (shorter) — truck 1 ends with mia,kai,bo and truck 2 with leo,ana.

💡 need a hint?

q-two-trucks.py🔒 given lines are locked — write your code in between
loading...