Share my Java postorder solution

We can solve this problem using postorder traversal, we use a helper function to perform the traversal and in the meantime let it return the max length of the consecutive sequence including the current node.

For leaf nodes and nodes that cannot form a consecutive sequence with their left or right child, the helper function will return 1, otherwise return the max of the left or right consecutive sequence plus one.