mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 16:01:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong>
|
||||
["TimeLimitedCache", "set", "get", "count", "get"]
|
||||
[[], [1, 42, 100], [1], [], [1]]
|
||||
[0, 0, 50, 50, 150]
|
||||
actions = ["TimeLimitedCache", "set", "get", "count", "get"]
|
||||
values = [[], [1, 42, 100], [1], [], [1]]
|
||||
timeDelays = [0, 0, 50, 50, 150]
|
||||
<strong>Output:</strong> [null, false, 42, 1, -1]
|
||||
<strong>Explanation:</strong>
|
||||
At t=0, the cache is constructed.
|
||||
@@ -30,10 +30,10 @@ At t=150, get(1) is called but -1 is returned because the cache is empty.
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong>
|
||||
["TimeLimitedCache", "set", "set", "get", "get", "get", "count"]
|
||||
[[], [1, 42, 50], [1, 50, 100], [1], [1], [1], []]
|
||||
[0, 0, 40, 50, 120, 200, 250]
|
||||
<strong>Output:</strong> [null, false, true, 50, 50, -1]
|
||||
actions = ["TimeLimitedCache", "set", "set", "get", "get", "get", "count"]
|
||||
values = [[], [1, 42, 50], [1, 50, 100], [1], [1], [1], []]
|
||||
timeDelays = [0, 0, 40, 50, 120, 200, 250]
|
||||
<strong>Output:</strong> [null, false, true, 50, 50, -1, 0]
|
||||
<strong>Explanation:</strong>
|
||||
At t=0, the cache is constructed.
|
||||
At t=0, a key-value pair (1: 42) is added with a time limit of 50ms. The value doesn't exist so false is returned.
|
||||
@@ -49,8 +49,12 @@ At t=250, count() returns 0 because the cache is empty.
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>0 <= key <= 10<sup>9</sup></code></li>
|
||||
<li><code>0 <= value <= 10<sup>9</sup></code></li>
|
||||
<li><code>0 <= key, value <= 10<sup>9</sup></code></li>
|
||||
<li><code>0 <= duration <= 1000</code></li>
|
||||
<li><code>total method calls will not exceed 100</code></li>
|
||||
<li><code>1 <= actions.length <= 100</code></li>
|
||||
<li><code>actions.length === values.length</code></li>
|
||||
<li><code>actions.length === timeDelays.length</code></li>
|
||||
<li><code>0 <= timeDelays[i] <= 1450</code></li>
|
||||
<li><code>actions[i]</code> is one of "TimeLimitedCache", "set", "get" and "count"</li>
|
||||
<li>First action is always "TimeLimitedCache" and must be executed immediately, with a 0-millisecond delay</li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user