LeetCode --- 933. Number of Recent Calls 解题报告
Posted 杨鑫newlfe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 933. Number of Recent Calls 解题报告相关的知识,希望对你有一定的参考价值。
You have a RecentCounter
class which counts the number of recent requests within a certain time frame.
Implement the RecentCounter
class:
RecentCounter()
Initializes the counter with zero recent requests.int ping(int t)
Adds a new request at timet
, wheret
represents some time in milliseconds, and returns the number of requests that has happened in the past3000
milliseconds (including the new request). Specifically, return the number of requests that have happened in the inclusive range[t - 3000, t]
.
It is guaranteed that every call to ping
uses a strictly larger value of t
than the previous call.
Example 1:
Input
["RecentCounter", "ping", "ping", "ping", "ping"]
[[], [1], [100
以上是关于LeetCode --- 933. Number of Recent Calls 解题报告的主要内容,如果未能解决你的问题,请参考以下文章
[LeetCode] 933. Number of Recent Calls 最近的调用次数
LeetCode.933-最近通话次数(Number of Recent Calls)
Leetcode-933 Number of Recent Calls(最近的请求次数)
LWC 109: 933.Number of Recent Calls