Given the root of a binary tree, return the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in the tree. This path may or may not pass through the root. The length of a path is measured by the number of edges between the nodes.
Topics
Companies
Articles
Examples:
N/A
Constraints:
0 = number of nodes = 105
-104 = Node.val = 104
Companies:
Microsoft
Topics:
Recursion
Please log in to access the Submissions tab, where you can review your progress and explore code submissions from other participants.
Please log in to access the Solution tab and view detailed answers and explanations.
Please log in to access the Discussion tab and join conversations with other participants.
Access Restricted: Please Login to access the code editor and test cases.