Skip to content

Commit 5564e55

Browse files
committed
Create README - LeetHub
1 parent f7fb87b commit 5564e55

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h2>209. Minimum Size Subarray Sum</h2><h3>Medium</h3><hr><div><p>Given an array of positive integers <code>nums</code> and a positive integer <code>target</code>, return the minimal length of a <strong>contiguous subarray</strong> <code>[nums<sub>l</sub>, nums<sub>l+1</sub>, ..., nums<sub>r-1</sub>, nums<sub>r</sub>]</code> of which the sum is greater than or equal to <code>target</code>. If there is no such subarray, return <code>0</code> instead.</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong>Example 1:</strong></p>
5+
6+
<pre><strong>Input:</strong> target = 7, nums = [2,3,1,2,4,3]
7+
<strong>Output:</strong> 2
8+
<strong>Explanation:</strong> The subarray [4,3] has the minimal length under the problem constraint.
9+
</pre>
10+
11+
<p><strong>Example 2:</strong></p>
12+
13+
<pre><strong>Input:</strong> target = 4, nums = [1,4,4]
14+
<strong>Output:</strong> 1
15+
</pre>
16+
17+
<p><strong>Example 3:</strong></p>
18+
19+
<pre><strong>Input:</strong> target = 11, nums = [1,1,1,1,1,1,1,1]
20+
<strong>Output:</strong> 0
21+
</pre>
22+
23+
<p>&nbsp;</p>
24+
<p><strong>Constraints:</strong></p>
25+
26+
<ul>
27+
<li><code>1 &lt;= target &lt;= 10<sup>9</sup></code></li>
28+
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
29+
<li><code>1 &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>
30+
</ul>
31+
32+
<p>&nbsp;</p>
33+
<strong>Follow up:</strong> If you have figured out the <code>O(n)</code> solution, try coding another solution of which the time complexity is <code>O(n log(n))</code>.</div>

0 commit comments

Comments
 (0)