Company: ION Software developer Oncampus_17july
Difficulty: medium
Total Transmitted Logs Problem Description A logging system keeps recent logs in a circular buffer that can hold at most bufferCapacity logs. Logs arrive one at a time in the order given. Log i arrives at time logTimestamp[i] (in milliseconds) and carries the tag logTag[i] . When a log arrives, the system does the following, in this order: If the buffer already holds bufferCapacity logs, the oldest log in the buffer is removed. The arriving log is added to the buffer. Every log currently in the buffer (including the one that just arrived) that has the same tag as the arriving log and whose timestamp is at most transmissionWindow milliseconds before the arriving log's timestamp is transmitted. Put mechanically: when log i arrives, the number of logs transmitted is the number of logs j in the buffer with logTag[j] == logTag[i] and logTimestamp[i] - logTimestamp[j] <= transmissionWindow . Transmitting a log does not remove it from the buffer, so the same log can be transmitted again wh