```
class Solution:
def postorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
res = []
stk = []
stk.append(root)
if not root:
return res
while stk:
node = stk.pop()
res.append(node.val)
if node.left:
stk.append(node.left)
if node.right:
stk.append(node.right)
return res[::-1]
```

The solution can be improved, because I suppose the final reversion is unnecessary.