In this, its taken a pair class for (H,D), but for the overall question we only need diameter. we can also make a function which return only int of D. and ofcourse diameter will be always greater then height. so we can do max of (h,d) and return that?
Fast diameter of tree question
but to calculate current node height we also need height of left and right subtree