class Solution:
def postorderTraversal(self , root: TreeNode) -> List[int]:
ans=[]
def postorder(root):
if not root: return
if root.left:
postorder(root.left)
if root.right:
postorder(root.right)
ans.append(root.val)
postorder(root)
return ans