Skip to content

Commit 0657ed3

Browse files
committed
Create README - LeetHub
1 parent dde2979 commit 0657ed3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<h2><a href="https://leetcode.com/problems/binary-tree-maximum-path-sum/">124. Binary Tree Maximum Path Sum</a></h2><h3>Hard</h3><hr><div><p>A <strong>path</strong> in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence <strong>at most once</strong>. Note that the path does not need to pass through the root.</p>
2+
3+
<p>The <strong>path sum</strong> of a path is the sum of the node's values in the path.</p>
4+
5+
<p>Given the <code>root</code> of a binary tree, return <em>the maximum <strong>path sum</strong> of any <strong>non-empty</strong> path</em>.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong>Example 1:</strong></p>
9+
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/13/exx1.jpg" style="width: 322px; height: 182px;">
10+
<pre><strong>Input:</strong> root = [1,2,3]
11+
<strong>Output:</strong> 6
12+
<strong>Explanation:</strong> The optimal path is 2 -&gt; 1 -&gt; 3 with a path sum of 2 + 1 + 3 = 6.
13+
</pre>
14+
15+
<p><strong>Example 2:</strong></p>
16+
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/13/exx2.jpg">
17+
<pre><strong>Input:</strong> root = [-10,9,20,null,null,15,7]
18+
<strong>Output:</strong> 42
19+
<strong>Explanation:</strong> The optimal path is 15 -&gt; 20 -&gt; 7 with a path sum of 15 + 20 + 7 = 42.
20+
</pre>
21+
22+
<p>&nbsp;</p>
23+
<p><strong>Constraints:</strong></p>
24+
25+
<ul>
26+
<li>The number of nodes in the tree is in the range <code>[1, 3 * 10<sup>4</sup>]</code>.</li>
27+
<li><code>-1000 &lt;= Node.val &lt;= 1000</code></li>
28+
</ul>
29+
</div>

0 commit comments

Comments
 (0)