So, depth of height?


  • 0
    S

    Sorry, can't understand.

    Input:
    [0]
    Output:
    0
    Expected:
    1
    

    Why?

    The depth of a node is the number of edges from the root to the node. The height of a node is the number of edges from the node to the deepest leaf. The height of a tree is a height of the root.

    There is root only. How depth can be 1?
    Where am I wrong?

    Update:
    I see in task

    The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
    

    But it is not depth, it's height.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.