filmov
tv
101 | Leetcode | Symmetric Binary Tree | #Python

Показать описание
#RecursiveSolution
class Solution:
def isSymmetric(self, root: TreeNode) :
def isSymmetrictree(node1,node2):
if not node1 and not node2:
return True
if not node1 or not node2:
return False
return False
if not root : return True
#Solution_using_queue
class Solution:
def isSymmetric(self, root: TreeNode) :
if not root : return True
while queue:
print(queue)
if not node1 and not node2:
continue
if not node1 or not node2:
return False
return False
return True
class Solution:
def isSymmetric(self, root: TreeNode) :
def isSymmetrictree(node1,node2):
if not node1 and not node2:
return True
if not node1 or not node2:
return False
return False
if not root : return True
#Solution_using_queue
class Solution:
def isSymmetric(self, root: TreeNode) :
if not root : return True
while queue:
print(queue)
if not node1 and not node2:
continue
if not node1 or not node2:
return False
return False
return True