Company: ION Software developer Oncampus_17july
Difficulty: medium
You receive n logs in ascending order of timestamp. Log i has: logTimestamp[i] — the time the log was recorded, in milliseconds; logTag[i] — a string tag. The system keeps a circular buffer that holds at most bufferCapacity logs. Logs arrive one by one, and each arrival is handled in exactly this order: Add the new log to the buffer. Evict: if adding the new log made the buffer exceed bufferCapacity , remove the oldest log from the buffer (a circular buffer never holds more than bufferCapacity logs). Transmit every log that is still in the buffer and that has the same tag as the newly arrived log, and has timestamp t with newTimestamp - t ≤ transmissionWindow . The newly arrived log itself is always in the buffer, matches its own tag, and satisfies the window condition, so it is always transmitted. Return the total number of transmitted logs over all arrivals, counting a log every time it is transmitted (the same log can be transmitted many times). Input Format The first