mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>写一个 <code>RecentCounter</code> 类来计算特定时间范围内最近的请求。</p>\n\n<p>请实现 <code>RecentCounter</code> 类:</p>\n\n<ul>\n\t<li><code>RecentCounter()</code> 初始化计数器,请求数为 0 。</li>\n\t<li><code>int ping(int t)</code> 在时间 <code>t</code> 添加一个新请求,其中 <code>t</code> 表示以毫秒为单位的某个时间,并返回过去 <code>3000</code> 毫秒内发生的所有请求数(包括新请求)。确切地说,返回在 <code>[t-3000, t]</code> 内发生的请求数。</li>\n</ul>\n\n<p><strong>保证</strong> 每次对 <code>ping</code> 的调用都使用比之前更大的 <code>t</code> 值。</p>\n\n<p> </p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入:</strong>\ninputs = ["RecentCounter", "ping", "ping", "ping", "ping"]\ninputs = [[], [1], [100], [3001], [3002]]\n<strong>输出:</strong>\n[null, 1, 2, 3, 3]\n\n<strong>解释:</strong>\nRecentCounter recentCounter = new RecentCounter();\nrecentCounter.ping(1); // requests = [<strong>1</strong>],范围是 [-2999,1],返回 1\nrecentCounter.ping(100); // requests = [<strong>1</strong>, <strong>100</strong>],范围是 [-2900,100],返回 2\nrecentCounter.ping(3001); // requests = [<strong>1</strong>, <strong>100</strong>, <strong>3001</strong>],范围是 [1,3001],返回 3\nrecentCounter.ping(3002); // requests = [1, <strong>100</strong>, <strong>3001</strong>, <strong>3002</strong>],范围是 [2,3002],返回 3\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= t <= 10<sup>9</sup></code></li>\n\t<li>保证每次对 <code>ping</code> 调用所使用的 <code>t</code> 值都 <strong>严格递增</strong></li>\n\t<li>至多调用 <code>ping</code> 方法 <code>10<sup>4</sup></code> 次</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 933 题相同: <a href=\"https://leetcode-cn.com/problems/number-of-recent-calls/\">https://leetcode-cn.com/problems/number-of-recent-calls/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 14,
|
||||
"likes": 15,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.9K\", \"totalSubmission\": \"11.9K\", \"totalAcceptedRaw\": 9874, \"totalSubmissionRaw\": 11862, \"acRate\": \"83.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10K\", \"totalSubmission\": \"12K\", \"totalAcceptedRaw\": 10003, \"totalSubmissionRaw\": 12027, \"acRate\": \"83.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user