Merge sorted server logs
Your task
Two app servers each produce a log that is already sorted by time. Every line starts with an integer Unix-seconds timestamp, then a space, then the entry text, for example "95 cache warmed". Merge the two logs into a single list sorted by timestamp (numeric comparison, beware that comparing "9" and "100" as strings orders them wrongly). When a line from each server carries the same timestamp, place server A's line first. Preserve each server's internal order.
Examples
merge_log_streams(a: list[str], b: list[str]) -> list[str]Example 1
Input
merge_log_streams(["5 gateway up", "100 request served"], ["9 cache warm"])Output
["5 gateway up", "9 cache warm", "100 request served"]