mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			991 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			991 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给定一个整数数组和一个整数 <code>k</code><strong> ,</strong>请找到该数组中和为 <code>k</code><strong> </strong>的连续子数组的个数。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [1,1,1], k = 2
 | 
						||
<strong>输出:</strong> 2
 | 
						||
<strong>解释:</strong> 此题 [1,1] 与 [1,1] 为两种不同的情况
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [1,2,3], k = 3
 | 
						||
<strong>输出:</strong> 2
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= nums.length <= 2 * 10<sup>4</sup></code></li>
 | 
						||
	<li><code>-1000 <= nums[i] <= 1000</code></li>
 | 
						||
	<li>
 | 
						||
	<p><code>-10<sup>7</sup> <= k <= 10<sup>7</sup></code></p>
 | 
						||
	</li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p>注意:本题与主站 560 题相同: <a href="https://leetcode-cn.com/problems/subarray-sum-equals-k/">https://leetcode-cn.com/problems/subarray-sum-equals-k/</a></p>
 |