You are given the root of a special binary tree containing n nodes, where each node.val is unique.
In this special binary tree, leaf nodes are linked together:
The left pointer of a leaf node points to the adjacent leaf node to its left, or is null if no such leaf exists.
The right pointer of a leaf node points to the adjacent leaf node to its right, or is null if no such leaf exists.
Return the height of the binary tree, defined as the maximum number of edges on a path from the root to any leaf node.
Constraints:
n is the number of nodes in the tree.
node.val
The input is generated such that each node.val is unique.
You are given the root of a special binary tree containing n nodes, where each node.val is unique.
In this special binary tree, leaf nodes are linked together:
The left pointer of a leaf node points to the adjacent leaf node to its left, or is null if no such leaf exists.
The right pointer of a leaf node points to the adjacent leaf node to its right, or is null if no such leaf exists.
Return the height of the binary tree, defined as the maximum number of edges on a path from the root to any leaf node.
Constraints:
n is the number of nodes in the tree.
node.val
The input is generated such that each node.val is unique.