def isSymmetric(self, root):
def isSym(L,R):
if not L and not R: return True
if L and R and L.val == R.val:
return isSym(L.left, R.right) and isSym(L.right, R.left)
return False
return isSym(root, root)
6line AC python

I simplify your isSym funciton:
def isSym(L,R): if L and R and L.val == R.val: return isSym(L.left, R.right) and isSym(L.right, R.left) return L == R
My Iterative solution.
def isSymmetric(self, root): queue = [root] while queue: values = [i.val if i else None for i in queue] if values != values[::1]: return False queue = [child for i in queue if i for child in (i.left, i.right)] return True


@lee215
Can you explain "queue = [child for i in queue if i for child in (i.left, i.right)]"
I do not know the means of "if i" above
