Determine whether a given binary tree is fully populated, where "fully populated" means that every internal node has exactly two children, and all terminal nodes are at the same depth.
Anonymous
When I started solving this one, I briefly considered (and verbalized) the idea of just counting the nodes in the tree, determining the height, and checking to see if node_count == 2^height - 1. In retrospect, that would have been a slick solution. The actual solution I implemented was recursive; note that a fully populated binary tree has two fully populated subtrees as children. You also have to check whether the subtrees are the same height.
Check out your Company Bowl for anonymous work chats.