Search
⌘K

Leetcode 543. Diameter of Binary Tree

Given the root of a binary tree, return the diameter — the maximum number of edges on any path between two nodes; the core challenge is to compute subtree heights and track the maximum sum of left and right heights at each node in a single O(n) traversal.

Asked at:

Meta


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late November, 2025

Meta

Senior

Early November, 2025

Meta

Mid-level

Early August, 2025

Meta

Senior

Comments

Your account is free and you can post anonymously if you choose.