A label rooted tree with exactly N nodes is a pleasant tree if and only if:
- each of its nodes is labeled with a positive integer between 1 to N.
- No 2 nodes have the same label
- A post-order traversal of the tree visited the nodes in increasing numerical order of its label.
This is essentially the same question as finding the number of possible binary search trees with n nodes.
The difference is that in this problem the order of the nodes is left subtree < right subtree < current node, instead of left subtree < current node < right subtree in a binary search tree.