Binary Tree - Diameter of the Tree Optimized Approach

how is this approach different from the previous one here also we are using recursion how is the complexity getting reduced

@jatinupadhyay786 in prev we were calling height inside the diameter one but in optimised we are calculating height and diameter using bottom up so only one traversal req

yeah so here we are calculating diameter and height simltaneously for every node?

@jatinupadhyay786 yes exactly