Question: IBM CIC, Recent Online Assessment Questions | Unordered Event Logs | 2026
0
Entering edit mode

Problem Statement: Unordered Log Processing

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:

  1. Deduplicate: If entries have the same timestamp and the same event_id, they are duplicates. Keep only one.

  2. Sort: Sort by timestamp in ascending order. Break ties by sorting the event_id lexicographically.

  3. 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
ADD COMMENTlink 2 days ago Anil • 0

Login before adding your answer.

Similar Posts
Loading Similar Posts