```
def postorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
if root == None:
return []
stack = []
stack.append(root)
result = []
while(len(stack)>0):
pop = stack.pop()
result.append(pop.val)
if pop.left != None:
stack.append(pop.left)
if pop.right != None:
stack.append(pop.right)
return list(reversed(result))
```