mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
31 lines
1004 B
HTML
31 lines
1004 B
HTML
<p>给你一个整数数组 <code>nums</code> 和两个整数:<code>left</code> 及 <code>right</code> 。找出 <code>nums</code> 中连续、非空且其中最大元素在范围 <code>[left, right]</code> 内的子数组,并返回满足条件的子数组的个数。</p>
|
||
|
||
<p>生成的测试用例保证结果符合 <strong>32-bit</strong> 整数范围。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [2,1,4,3], left = 2, right = 3
|
||
<strong>输出:</strong>3
|
||
<strong>解释:</strong>满足条件的三个子数组:[2], [2, 1], [3]
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [2,9,2,5,6], left = 2, right = 8
|
||
<strong>输出:</strong>7
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>
|
||
<li><code>0 <= nums[i] <= 10<sup>9</sup></code></li>
|
||
<li><code>0 <= left <= right <= 10<sup>9</sup></code></li>
|
||
</ul>
|