from typing import Optional from tree import TreeNode class Polution: def isSymmetric(self, root: Optional[TreeNode]) -> bool: p = root.left q = root.right while p and q: if p.val == q.val: p = p.left q = q.right else: return False