You are given the root of a binary tree.
Your task is to return the postorder traversal of the values of its nodes.
Note that:
root node itself.Return a list of integers representing the node values in postorder.
[3, 2, 1]
The postorder traversal is Left -> Right -> Root. For the given tree, the left subtree is null, the right subtree is node 2 (which has a left child 3), so we visit 3, then 2, then the root 1.
None
[]
An empty tree has no nodes, so the traversal is an empty list.
[1, 3, 2, 6, 9, 7, 4]
Following Left -> Right -> Root traversal order results in the sequence [1, 3, 2, 6, 9, 7, 4].
[3, 2, 1]