Company: Flexport_26nov
Difficulty: medium
Log Analysis 2 Log Analysis 2 Problem Description Analyze logs of requests processed by n servers. The servers are indexed from 1 to n . The logs are provided as an array log_data where each entry log_data[i] = [server_id, time] indicates that a request was served by server with ID server_id at time time . Given log_data , an integer n , an integer x , and q queries, determine for each query the number of servers that did not receive any request in the time interval [query[i] - x, query[i]] . Complete the function getStaleServerCount to solve this problem. Examples Example 1: n = 3 x = 5 log_data = [[1, 3], [2, 6], [1, 5]] query = [10, 11] Output: [1, 2] Explanation: There are 3 servers in total (1, 2, 3). For the first query, query[0] = 10 , the time interval is [10 - 5, 10] which is [5, 10] . In this interval, server 1 received a request at time 5, and server 2 received a request at time 6. Server 3 did not receive any requests. The count of servers not receiving a request is 1. For