注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
Input: An array with strings of "<client name> <timestamp>", and a number "Y" of maximum requests per minute per client
Criteria 1: If a client issues too many requests to the server (> Y), the excessive requests would be regarded as overflow and dropped.
Criteria 2: In a window of 5 minutes and total requests in the request per user, 1 hashmap to count the request in the time window, and 1 hashmap to parse the vector of string to the vector of timestamp per user.
O(M) space complexity, O(M) Time complexity.
|