The problem, in one line. Given a binary tree, return the length in edges of the longest path between any two nodes, whether or not it passes through the root. LeetCode 543.
The tell. The words “any two nodes” with no mention of the root. When the best path can bend at any node, ask every node what its own best bend would be, and keep a running best.