Problem 608 · Medium

Tree Node

Label each node of a tree as the root, an inner node, or a leaf. The visual colours each row by whether it has a parent and whether it has children.

Open the interactive visualisation