Skip to content

Commit eee9571

Browse files
committed
Create README - LeetHub
1 parent 3f31dfa commit eee9571

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

0053-maximum-subarray/README.md

+35
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>Medium</h3><hr><div><p>Given an integer array <code>nums</code>, find the <span data-keyword="subarray-nonempty">subarray</span> with the largest sum, and return <em>its sum</em>.</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong class="example">Example 1:</strong></p>
5+
6+
<pre><strong>Input:</strong> nums = [-2,1,-3,4,-1,2,1,-5,4]
7+
<strong>Output:</strong> 6
8+
<strong>Explanation:</strong> The subarray [4,-1,2,1] has the largest sum 6.
9+
</pre>
10+
11+
<p><strong class="example">Example 2:</strong></p>
12+
13+
<pre><strong>Input:</strong> nums = [1]
14+
<strong>Output:</strong> 1
15+
<strong>Explanation:</strong> The subarray [1] has the largest sum 1.
16+
</pre>
17+
18+
<p><strong class="example">Example 3:</strong></p>
19+
20+
<pre><strong>Input:</strong> nums = [5,4,-1,7,8]
21+
<strong>Output:</strong> 23
22+
<strong>Explanation:</strong> The subarray [5,4,-1,7,8] has the largest sum 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)