Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update lc problems #1522

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions solution/0900-0999/0928.Minimize Malware Spread II/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<p><strong>示例 1:</strong></p>

<pre>
<strong>输出:</strong>graph = [[1,1,0],[1,1,0],[0,0,1]], initial = [0,1]
<strong>输入:</strong>0
<strong>输入:</strong>graph = [[1,1,0],[1,1,0],[0,0,1]], initial = [0,1]
<strong>输出:</strong>0
</pre>

<p><strong>示例 2:</strong></p>
Expand Down
49 changes: 24 additions & 25 deletions solution/2700-2799/2715.Timeout Cancellation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,52 @@

<!-- 这里写题目描述 -->

<p>Given a function <code>fn</code>, an array of&nbsp;arguments&nbsp;<code>args</code>, and a timeout&nbsp;<code>t</code>&nbsp;in milliseconds, return a cancel function <code>cancelFn</code>.</p>
<p>现给定一个函数 <code>fn</code>&nbsp;,一个参数数组 <code>args</code> 和一个以毫秒为单位的超时时间 <code>t</code> ,返回一个取消函数 <code>cancelFn</code></p>

<p>After a delay of&nbsp;<code>t</code>,&nbsp;<code>fn</code>&nbsp;should be called with <code>args</code> passed as parameters <strong>unless</strong> <code>cancelFn</code> was invoked before the delay of <code>t</code> milliseconds elapses, specifically at <code>cancelT</code>&nbsp;ms.&nbsp;In that case,&nbsp;<code>fn</code> should never be called.</p>
<p>在经过 <code>t</code> 毫秒的延迟后,应该调用 <code>fn</code> 函数,并将 <code>args</code> 作为参数传递。<strong>除非</strong> <code>t</code> 毫秒的延迟过程中,在 <code>cancelT</code> 毫秒时调用了 <code>cancelFn</code>。并且在这种情况下,<code>fn</code> 函数不应该被调用。</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<p><strong class="example">示例 1:</strong></p>

<pre>
<strong>Input:</strong> fn = (x) =&gt; x * 5, args = [2], t = 20, cancelT = 50
<strong>Output:</strong> [{&quot;time&quot;: 20, &quot;returned&quot;: 10}]
<strong>Explanation:</strong>
const cancel = cancellable((x) =&gt; x * 5, [2], 20); // fn(2) called at t=20ms
<b>输入:</b>fn = (x) =&gt; x * 5, args = [2], t = 20, cancelT = 50
<b>输出:</b>[{"time": 20, "returned": 10}]
<b>解释:</b>
const cancel = cancellable((x) =&gt; x * 5, [2], 20); // fn(2) t=20ms 时被调用
setTimeout(cancel, 50);

The cancellation was scheduled to occur after a delay of cancelT (50ms), which happened after the execution of fn(2) at 20ms.
</pre>
取消操作被安排在延迟了 cancelT(50毫秒)后进行,这发生在 fn(2) 在20毫秒时执行之后。</pre>

<p><strong class="example">Example 2:</strong></p>
<p><strong class="example">示例 2:</strong></p>

<pre>
<strong>Input:</strong> fn = (x) =&gt; x**2, args = [2], t = 100, cancelT = 50
<strong>Output:</strong> []
<strong>Explanation:</strong>
const cancel = cancellable((x) =&gt; x**2, [2], 100); // fn(2) not called
<b>输入:</b>fn = (x) =&gt; x**2, args = [2], t = 100, cancelT = 50
<b>输出:</b>[]
<b>解释:</b>
const cancel = cancellable((x) =&gt; x**2, [2], 100); // fn(2) 没被调用
setTimeout(cancel, 50);

The cancellation was scheduled to occur after a delay of cancelT (50ms), which happened before the execution of fn(2) at 100ms, resulting in fn(2) never being called.
取消操作被安排在延迟了 cancelT(50毫秒)后进行,这发生在 fn(2) 在100毫秒时执行之前,导致 fn(2) 从未被调用。
</pre>

<p><strong class="example">Example 3:</strong></p>
<p><strong class="example">示例 3:</strong></p>

<pre>
<strong>Input:</strong> fn = (x1, x2) =&gt; x1 * x2, args = [2,4], t = 30, cancelT = 100
<strong>Output:</strong> [{&quot;time&quot;: 30, &quot;returned&quot;: 8}]
<strong>Explanation:</strong>
const cancel = cancellable((x1, x2) =&gt; x1 * x2, [2,4], 30); // fn(2,4) called at t=30ms
<b>输入:</b>fn = (x1, x2) =&gt; x1 * x2, args = [2,4], t = 30, cancelTime = 100
<b>输出:</b>[{"time": 30, "returned": 8}]
<b>解释:</b>
const cancel = cancellable((x1, x2) =&gt; x1 * x2, [2,4], 30); // fn(2,4) t=30ms 时被调用
setTimeout(cancel, 100);

The cancellation was scheduled to occur after a delay of cancelT (100ms), which happened after the execution of fn(2,4) at 30ms.
取消操作被安排在延迟了 cancelT(100毫秒)后进行,这发生在 fn(2,4) 在30毫秒时执行之后。
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<p><strong>提示:</strong></p>

<ul>
<li><code>fn is a function</code></li>
<li><code>args is a valid JSON array</code></li>
<li><code>fn 是一个函数</code></li>
<li><code>args 是一个有效的 JSON 数组</code></li>
<li><code>1 &lt;= args.length &lt;= 10</code></li>
<li><code><font face="monospace">20 &lt;= t &lt;= 1000</font></code></li>
<li><code><font face="monospace">10 &lt;= cancelT &lt;= 1000</font></code></li>
Expand Down
Loading