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

add leetcode problem-cn part3

This commit is contained in:
2022-03-27 20:46:41 +08:00
parent 6dafca13c5
commit dfacb20d31
1385 changed files with 115239 additions and 3 deletions

View File

@@ -0,0 +1,31 @@
<p>给你一个二元数组 <code>nums</code> ,和一个整数 <code>goal</code> ,请你统计并返回有多少个和为 <code>goal</code><strong> 非空</strong> 子数组。</p>
<p><strong>子数组</strong> 是数组的一段连续部分。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = [1,0,1,0,1], goal = 2
<strong>输出:</strong>4
<strong>解释:</strong>
有 4 个满足题目要求的子数组:[1,0,1]、[1,0,1,0]、[0,1,0,1]、[1,0,1]
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = [0,0,0,0,0], goal = 0
<strong>输出:</strong>15
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= nums.length <= 3 * 10<sup>4</sup></code></li>
<li><code>nums[i]</code> 不是 <code>0</code> 就是 <code>1</code></li>
<li><code>0 <= goal <= nums.length</code></li>
</ul>