Algorithm · Uber · Hard
Problem You are given a binary tree. Define a Node class with attributes val, left, and right. Then, in a single traversal, compute the following three results: Total sum of all node values in the tree. Maximum path sum – a path is any simple path that follows parent‑child edges (it may consist of a single node). The path sum is the sum of the node values along that path. One node‑value sequence that achieves the maximum path sum, from one endpoint to the other. If several…
Checking your access…