java.lang.Object
g0101_0200.s0145_binary_tree_postorder_traversal.Solution

public class Solution extends Object
145 - Binary Tree Postorder Traversal.<p>Easy</p> <p>Given the <code>root</code> of a binary tree, return <em>the postorder traversal of its nodes&rsquo; values</em>.</p> <p><strong>Example 1:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2020/08/28/pre1.jpg" alt="" /></p> <p><strong>Input:</strong> root = [1,null,2,3]</p> <p><strong>Output:</strong> [3,2,1]</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> root = []</p> <p><strong>Output:</strong> []</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> root = [1]</p> <p><strong>Output:</strong> [1]</p> <p><strong>Example 4:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2020/08/28/pre3.jpg" alt="" /></p> <p><strong>Input:</strong> root = [1,2]</p> <p><strong>Output:</strong> [2,1]</p> <p><strong>Example 5:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2020/08/28/pre2.jpg" alt="" /></p> <p><strong>Input:</strong> root = [1,null,2]</p> <p><strong>Output:</strong> [2,1]</p> <p><strong>Constraints:</strong></p> <ul> <li>The number of the nodes in the tree is in the range <code>[0, 100]</code>.</li> <li><code>-100 <= Node.val <= 100</code></li> </ul> <p><strong>Follow up:</strong> Recursive solution is trivial, could you do it iteratively?</p>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details