1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/统计完全子数组的数目 [count-complete-subarrays-in-an-array].html
2023-08-11 23:36:00 +08:00

37 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个由 <strong></strong> 整数组成的数组 <code>nums</code></p>
<p>如果数组中的某个子数组满足下述条件,则称之为 <strong>完全子数组</strong> </p>
<ul>
<li>子数组中 <strong>不同</strong> 元素的数目等于整个数组不同元素的数目。</li>
</ul>
<p>返回数组中 <strong>完全子数组</strong> 的数目。</p>
<p><strong>子数组</strong> 是数组中的一个连续非空序列。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>nums = [1,3,1,2,2]
<strong>输出:</strong>4
<strong>解释:</strong>完全子数组有:[1,3,1,2]、[1,3,1,2,2]、[3,1,2] 和 [3,1,2,2] 。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>nums = [5,5,5,5]
<strong>输出:</strong>10
<strong>解释:</strong>数组仅由整数 5 组成,所以任意子数组都满足完全子数组的条件。子数组的总数为 10 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 1000</code></li>
<li><code>1 &lt;= nums[i] &lt;= 2000</code></li>
</ul>