```
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
mylist = []
class Solution:
# @param root, a tree node
# @return a list of integers
def postorderTraversal(self, root):
if not root:
return []
self.postorderTraversal(root.left)
self.postorderTraversal(root.right)
mylist.append(root.val)
return my list
```

When testing for {1,2} got [1,2,1], which supposed to be [2,1]. But this code is correct on my computer.

Can anyone help me?