ByteByteGo logo
menuProblems List

Maximum Sum of a Continuous Path in a Binary Tree

Hard

Return the maximum sum of a continuous path in a binary tree. A path is defined by the following characteristics:

  • Consists of a sequence of nodes that can begin and end at any node in the tree
  • Each consecutive pair of nodes in the sequence is connected by an edge
  • The path must be a single continuous sequence of nodes that doesn't split into multiple paths

Example:

Output: 30

Constraints:

  • The tree contains at least one node.

You can practice coding exercises online by logging into bytebytego.com on your laptop.