Skip to content

Bug Report for depth-of-binary-tree #5841

@Nik83534

Description

@Nik83534

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.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions