Diameter of Binary Tree (LC #543) finds the longest path between any two nodes. The path may or may not pass through the root. For each node, compute left height plus right height. Track the global maximum. Return height plus for the recursive call. This runs in time and space. Meta always asks the variant: how would you find the diameter of an N-ary tree? The approach is similar but you track the two largest child heights instead of just left and right.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/meta-interview-prep/trees/diameter-of-binary-tree
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████████████████████████████████████████████████████████████