-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97d335b
commit 7882219
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<h2><a href="https://leetcode.com/problems/counter/">2620. Counter</a></h2><h3>Easy</h3><hr><div><p>Given an integer <code>n</code>, return a <code>counter</code> function. This <code>counter</code> function initially returns <code>n</code> and then returns 1 more than the previous value every subsequent time it is called (<code>n</code>, <code>n + 1</code>, <code>n + 2</code>, etc).</p> | ||
|
||
<p> </p> | ||
<p><strong class="example">Example 1:</strong></p> | ||
|
||
<pre><strong>Input:</strong> | ||
n = 10 | ||
["call","call","call"] | ||
<strong>Output:</strong> [10,11,12] | ||
<strong>Explanation: | ||
</strong>counter() = 10 // The first time counter() is called, it returns n. | ||
counter() = 11 // Returns 1 more than the previous time. | ||
counter() = 12 // Returns 1 more than the previous time. | ||
</pre> | ||
|
||
<p><strong class="example">Example 2:</strong></p> | ||
|
||
<pre><strong>Input:</strong> | ||
n = -2 | ||
["call","call","call","call","call"] | ||
<strong>Output:</strong> [-2,-1,0,1,2] | ||
<strong>Explanation:</strong> counter() initially returns -2. Then increases after each sebsequent call. | ||
</pre> | ||
|
||
<p> </p> | ||
<p><strong>Constraints:</strong></p> | ||
|
||
<ul> | ||
<li><code>-1000<sup> </sup><= n <= 1000</code></li> | ||
<li><code>0 <= calls.length <= 1000</code></li> | ||
<li><code>calls[i] === "call"</code></li> | ||
</ul> | ||
</div> |