We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent edacbcc commit ce8a386Copy full SHA for ce8a386
problems/symmetric-tree.py
@@ -15,4 +15,22 @@ def isSymmetric(self, root):
15
if left_node.val!=right_node.val: return False
16
q.append((left_node.right, right_node.left))
17
q.append((left_node.left, right_node.right))
18
- return True
+ return True
19
+
20
21
+# class Solution(object):
22
+# def isSymmetric(self, root):
23
+# if not root: return True
24
25
+# stack = []
26
+# stack.append((root.left, root.right))
27
+# while stack:
28
+# left_node, right_node = stack.pop()
29
+# if not left_node and right_node: return False
30
+# if not right_node and left_node: return False
31
32
+# if left_node and right_node:
33
+# if left_node.val!=right_node.val: return False
34
+# stack.append((left_node.right, right_node.left))
35
+# stack.append((left_node.left, right_node.right))
36
+# return True
0 commit comments