Edges or Nodes?


This compiler is compiling the height based on the nodes. Shouldn’t it be based on Edges? Eg: for one node it returns 1 as height. Shouldn’t it be 0 as there no edges.


It depends on the problem and in this case:

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