-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c014078
commit 5e875f8
Showing
1 changed file
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<h2><a href="https://www.geeksforgeeks.org/problems/maximum-path-sum-from-any-node/1">Maximum path sum from any node</a></h2><h3>Difficulty Level : Difficulty: Medium</h3><hr><div class="problems_problem_content__Xm_eO"><p><span style="font-size: 14pt;">Given a binary tree, the task is to find the maximum path sum. The path may start and end at any node in the tree.</span></p> | ||
<p><span style="font-size: 14pt;"><strong>Examples:</strong></span></p> | ||
<pre><span style="font-size: 14pt;"><strong>Input: </strong>root[] = [10, 2, 10, 20, 1, N, -25, N, N, N, N, 3, 4] | ||
<strong>Output: </strong>42<strong> | ||
Explanation: </strong><br><img src="https://media.geeksforgeeks.org/img-practice/prod/addEditProblem/700611/Web/Other/blobid3_1736948585.png" alt="" width="481" height="307"><br>Max path sum is represented using green colour nodes in the above binary tree.</span></pre> | ||
<pre><span style="font-size: 14pt;"><strong>Input: </strong>root[] = [-17, 11, 4, 20, -2, 10] | ||
<strong>Output: </strong>31<strong> | ||
Explanation: <br></strong><img src="https://media.geeksforgeeks.org/img-practice/prod/addEditProblem/700611/Web/Other/blobid1_1736947534.png" alt="" width="479" height="418"><br>Max path sum is represented using green colour nodes in the above binary tree.</span></pre> | ||
<p><span style="font-size: 14pt;"><strong>Constraints:</strong><br>1 ≤ number of nodes ≤ 10<sup>3</sup><br>-10<sup>4</sup> ≤ node->data ≤ 10<sup>4</sup></span></p></div><p><span style=font-size:18px><strong>Company Tags : </strong><br><code>Flipkart</code> <code>Google</code> <code>Facebook</code> <br><p><span style=font-size:18px><strong>Topic Tags : </strong><br><code>Tree</code> <code>Data Structures</code> |