Loading Similar Posts
A distributed system generates event logs. Due to a network issue, logs arrived out of order and some were duplicated. Each log entry has the format T<timestamp>:<event_id> where the timestamp is a non-negative integer.
Given N such log strings (with duplicates possible), you must:
Deduplicate: If entries have the same timestamp and the same event_id, they are duplicates. Keep only one.
Sort: Sort by timestamp in ascending order. Break ties by sorting the event_id lexicographically.
Output: Output only the event_ids, one per line, in their final sorted order.
Output Format:
Event IDs in sorted order, one per line.
Example Input:
5
T100:boot
T105:db_read
T100:boot
T102:auth_check
T105:cache_miss
Example Output:
boot
auth_check
cache_miss
db_read