Boundary of a binary tree
Walk around the outside of a binary tree starting at the root: down the left edge, along the leaves from left to right, then up the right edge. The nodes you pass form the boundary. Return the boundary (or the sum of its values), counting every node once.
Be careful with the root, a tree with no left or right subtree, and nodes that are both an edge node and a leaf. A variant asks the same of a complete, balanced tree.
No answer yet. Write the first one; the best answer gets endorsed.
