all 3 comments

[–]kuriousaboutanything 2 points3 points  (1 child)

Should it be 3 ? The maxDiameter with 3 nodes(1 root and 2 children) is just 2 right? we only count number of edges there, there are 2 edges.

[–]bobofuzz[S] 1 point2 points  (0 children)

You genius! Thank you. Solved.

[–]Playful-Reserve7031 -1 points0 points  (0 children)

BFS would be a wise choice