The distance between a node in a Binary Tree and the tree’s root is called the node’s depth.
Write a function that takes in a Binary Tree and returns the sum of all of its subtrees’ nodes’ depths.
Each BinaryTree
node has an integer value
, a left
child node, and a right
child node. Children nodes can either be BinaryTree
nodes themselves or None
/ null
.
Quick Links
Legal Stuff