Given an n-ary tree, return the postorder traversal of its nodes’ values.
For example, given a 3-ary tree:
Return its postorder traversal as: [5,6,3,2,4,1].
Note
Recursive solution is trivial, could you do it iteratively?
Code
1 | public class Node { |
1 | public List<Integer> postorder(Node root) { |