Problem Description
Given a binary tree, return the Postorder traversal of its nodes values.
NOTE: Using recursion is not allowed.
1 <= number of nodes <= 105
First and only argument is root node of the binary tree, A.
Return an integer array denoting the Postorder traversal of the given binary tree.
Input 1:
1 \ 2 / 3
Input 2:
1 / \ 6 2 / 3
Output 1:
[3, 2, 1]
Output 2:
[6, 3, 2, 1]
Explanation 1:
The Preoder Traversal of the given tree is [3, 2, 1].
Explanation 2:
The Preoder Traversal of the given tree is [6, 3, 2, 1].
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.