Skip to content

Commit 3b19e4d

Browse files
committed
Create README - LeetHub
1 parent a8989d1 commit 3b19e4d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

53-maximum-subarray/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h2><a href="https://leetcode.com/problems/maximum-subarray/">53. Maximum Subarray</a></h2><h3>Easy</h3><hr><div><p>Given an integer array <code>nums</code>, find the contiguous subarray (containing at least one number) which has the largest sum and return <em>its sum</em>.</p>
2+
3+
<p>A <strong>subarray</strong> is a <strong>contiguous</strong> part of an array.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong>Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> nums = [-2,1,-3,4,-1,2,1,-5,4]
9+
<strong>Output:</strong> 6
10+
<strong>Explanation:</strong> [4,-1,2,1] has the largest sum = 6.
11+
</pre>
12+
13+
<p><strong>Example 2:</strong></p>
14+
15+
<pre><strong>Input:</strong> nums = [1]
16+
<strong>Output:</strong> 1
17+
</pre>
18+
19+
<p><strong>Example 3:</strong></p>
20+
21+
<pre><strong>Input:</strong> nums = [5,4,-1,7,8]
22+
<strong>Output:</strong> 23
23+
</pre>
24+
25+
<p>&nbsp;</p>
26+
<p><strong>Constraints:</strong></p>
27+
28+
<ul>
29+
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
30+
<li><code>-10<sup>4</sup> &lt;= nums[i] &lt;= 10<sup>4</sup></code></li>
31+
</ul>
32+
33+
<p>&nbsp;</p>
34+
<p><strong>Follow up:</strong> If you have figured out the <code>O(n)</code> solution, try coding another solution using the <strong>divide and conquer</strong> approach, which is more subtle.</p>
35+
</div>

0 commit comments

Comments
 (0)