Java | Simple recursion | Clean code
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n  private void postorder(Node node, List<Integer> list) {\n    if (node == null) return;\n\n    for (var child : node.children)\n      postorder(child, list);\n\n    list.add(node.val);\n  }\n\n  public List<Integer> postorder(Node root) {\n    List<Integer> list = new ArrayList<>();\n    postorder(root, list);\n    return list;\n  }\n}\n```\nIf you like my solution, please upvote it!
['Tree', 'Depth-First Search', 'Java']