Bug Report for https://neetcode.io/problems/depth-of-binary-tree
There seems to be an inconsistency in the “Diameter of Binary Tree” examples.
For:
root = [1,null,2]
the output is shown as:
2
which counts the diameter in terms of nodes.
But for:
root = [1,2,3,null,null,4]
the output is shown as:
3
which counts the diameter in terms of edges.
Diameter should be measured consistently using either:
- number of edges
or
- number of nodes
Under the standard definition (edges), the first example should return:
1
not 2.

Bug Report for https://neetcode.io/problems/depth-of-binary-tree
There seems to be an inconsistency in the “Diameter of Binary Tree” examples.
For:
root = [1,null,2]
the output is shown as:
2
which counts the diameter in terms of nodes.
But for:
root = [1,2,3,null,null,4]
the output is shown as:
3
which counts the diameter in terms of edges.
Diameter should be measured consistently using either:
or
Under the standard definition (edges), the first example should return:
1
not 2.