1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-07 00:11:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -1,16 +1,16 @@
<p>请你编写并返回一个&nbsp;<strong>计数器&nbsp;</strong>函数,它接收一个整型参数 n 。这个&nbsp;<strong>计数器&nbsp;</strong>函数最初返回 n,每次调用它时返回前一个值加 1 的值 ( <code>n</code> ,&nbsp; <code>n + 1</code> ,&nbsp; <code>n + 2</code> ,等等)。</p>
<p>给定一个整型参数 <code>n</code>,请你编写并返回一个 <code>counter</code><strong>&nbsp;</strong>函数。这个&nbsp;<code>counter</code><strong>&nbsp;</strong>函数最初返回 <code>n</code>,每次调用它时返回前一个值加 1 的值 ( <code>n</code> ,&nbsp; <code>n + 1</code> ,&nbsp; <code>n + 2</code> ,等等)。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<b>输入:</b>
<strong>输入:</strong>
n = 10
["call","call","call"]
<b>输出:</b>[10,11,12]
<strong>解释:
</strong>counter() = 10 // 第一次调用 counter(),返回 n。
<strong>输出:</strong>[10,11,12]
<strong>解释:</strong>
counter() = 10 // 第一次调用 counter(),返回 n。
counter() = 11 // 返回上次调用的值加 1。
counter() = 12 // 返回上次调用的值加 1。
</pre>
@@ -18,11 +18,11 @@ counter() = 12 // 返回上次调用的值加 1。
<p><strong>示例 2</strong></p>
<pre>
<b>输入:</b>
<strong>输入:</strong>
n = -2
["call","call","call","call","call"]
<b>输出:</b>[-2,-1,0,1,2]
<b>解释:</b>counter() 最初返回 -2。然后在每个后续调用后增加 1。
<strong>输出:</strong>[-2,-1,0,1,2]
<strong>解释:</strong>counter() 最初返回 -2。然后在每个后续调用后增加 1。
</pre>
<p>&nbsp;</p>
@@ -31,5 +31,6 @@ n = -2
<ul>
<li><code>-1000<sup>&nbsp;</sup>&lt;= n &lt;= 1000</code></li>
<li><code>最多对 counter() 进行 1000 次调用</code></li>
<li><code>0 &lt;= calls.length &lt;= 1000</code></li>
<li><code>calls[i] === "call"</code></li>
</ul>