Your question is Maximum Path Sum in Tree. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given the root of a binary tree, return the maximum sum of any path. A path may start and end at any nodes, must follow parent-child edges, and cannot revisit a node.