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

add leetcode problem-cn part6

This commit is contained in:
2022-03-27 20:56:26 +08:00
parent c11d601602
commit 08d1f2a596
1096 changed files with 88216 additions and 2 deletions

View File

@@ -0,0 +1,39 @@
<p>如果一个数列 <strong>至少有三个元素</strong> ,并且任意两个相邻元素之差相同,则称该数列为等差数列。</p>
<ul>
<li>例如,<code>[1,3,5,7,9]</code><code>[7,7,7,7]</code><code>[3,-1,-5,-9]</code> 都是等差数列。</li>
</ul>
<div class="original__bRMd">
<div>
<p>给你一个整数数组 <code>nums</code> ,返回数组 <code>nums</code> 中所有为等差数组的 <strong>子数组</strong> 个数。</p>
<p><strong>子数组</strong> 是数组中的一个连续序列。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = [1,2,3,4]
<strong>输出:</strong>3
<strong>解释:</strong>nums 中有三个子等差数组:[1, 2, 3]、[2, 3, 4] 和 [1,2,3,4] 自身。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = [1]
<strong>输出:</strong>0
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= nums.length <= 5000</code></li>
<li><code>-1000 <= nums[i] <= 1000</code></li>
</ul>
</div>
</div>