Company: AT and T
Difficulty: medium
\n Stale Server Detector \n \n \n Implement a prototype service to analyze logs of requests on n servers. \n \n The servers are indexed from 1 to n. The logs of the servers are given as an array log_data of size m where log_data[i] = [server_id, time] denoting that a request was served by the server with id server_id at time time. \n \n Given log_data, an integer parameter x and q queries, for each query[i], find the number of servers that did not receive a request in the time interval [query[i] - x, query[i]]. \n \n\n \n Function Description \n Complete the function getStaleServerCount with the following parameters: \n \n int n : the number of servers \n int log_data[m][2] : the logs of the servers \n int query[q] : the queries \n x : an integer parameter for queries \n \n \n Returns \n int[q] : the answers to the queries \n \n\n \n Constraints \n \n 1 ≤ n ≤ 10 5 \n 1 ≤ m ≤ 10 5 \n 1 ≤ q ≤ 10 5 \n 1 ≤ log_data[i][0] ≤ n \n 1 ≤ log_data[i][1] ≤ 10 5 \n 1 ≤ query[i] ≤ 10 5 \n 1 ≤ x ≤ 10