Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Problem Submissions Solution

Diameter of Binary Tree

Difficulty: Medium

Acceptance: 75.00%

Points: 30.00

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
Locked Content
Access Restricted: Please Login to access the code editor and test cases.