Company: Oracle_23sep
Difficulty: medium
API Rate Limiter Implementation Problem Description You are building a rate limiter for an API service. Given a list of requests, where each request has a user ID and a timestamp, determine if the request should be allowed. A request is allowed only if the user has made fewer than k requests in the past 1-minute window. The function getAllowedRequests will take three inputs: int user[n] : the IDs of the users int timestamp[n] : the timestamp of requests in seconds int k : the allowed number of requests in any 1-minute window The function should return an array of integers where the i th element is 1 if the i th request is allowed; otherwise, it should be 0 . Note: If a request is not allowed due to the rate limit, it is not counted as a valid request for future rate limit counting. Examples Example 1: Input: n = 3, user = [1,1,1], timestamp = [1,10,65], k = 2 Output: [1,1,0] Explanation: The rate limit allows a user to make at most k=2 requests in any 1-minute (60-second) window. Reque