(self, pRoot1, pRoot2)
| 27 | def isSymmetric(self, root): |
| 28 | return self._Symmetrical(root, root) |
| 29 | def _Symmetrical(self, pRoot1, pRoot2): |
| 30 | if pRoot1 and pRoot2: |
| 31 | return pRoot1.val == pRoot2.val and self._Symmetrical(pRoot1.left, pRoot2.right) and self._Symmetrical( |
| 32 | pRoot1.right, pRoot2.left) |
| 33 | else: |
| 34 | return pRoot1 == pRoot2 |
| 35 | |
| 36 | #iterative(BFS) |
| 37 | def isSymmetric2(self, root): |