Binary Tree Path Sum - Maximum Sum between any nodes

Problem A path 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 at most once. Note that the path does not need to pass through the root. The path sum of a path is the sum of the node’s values in the path. Given the root of a binary tree, return the maximum path sum of any non-empty path. ...

Path Sum 3 - Count paths from parent to child

Problem Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum. The path does not need to start or end at the root or a leaf, but it must go downwards (i.e., traveling only from parent nodes to child nodes). Examples Example 1: ...

Path Sum 2 - find all root to leaf paths

Problem Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. Examples Example 1: graph TD; A[5] --> B[4] & C[8] B --> D[11] & E[null] C --> F[13] & G[4] D --> H[7] & I[2] G --> L[5] & M[1] style A fill:#f9f style B fill:#f9f style C fill:#f9f style D fill:#f9f style I fill:#f9f style G fill:#f9f style L fill:#f9f ...

This site uses cookies to improve your experience on our website. By using and continuing to navigate this website, you accept this. Privacy Policy