← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given a list of timestamps at which a chat service’s get_messages(ts) function is called. Each call returns all messages whose timestamps fall in the 5-second window [ts-5, ts+5] (or [0, ts+5] if ts-5 < 0). The same message may be returned by multiple calls. Your task is to merge the results of these calls so that every message appears only once in the final list, and the list is sorted by the message’s original timestamp. Implement a function that takes the list of query timestamps and returns the merged, deduplicated list of message IDs in the order they first appear.