Diameter points of a binary tree: what the root node needs to do is to add the height of the left subtree and the right subtree, and then add 1 to get the diameter length of the node. An intermediate variable Max is used to record the longest diameter, and the final Max is the result. Calculate the diameter: 1. Get the height of the left subtree 2. Get the height of the right subtree 3. Add 1.

Important: The diameter of a binary tree is the maximum number of nodes formed by the left and right subtrees and the root node minus one. Set an intermediate variable Max, and compare the number of nodes formed by left and right subtrees and root nodes with Max each time. Save the larger node with Max until the longest node path formed by all left and right subtrees and root nodes is Max, and the maximum diameter is Max with max-1 finally. And the essence of this problem is to find the depth of the tree.