def isSameTree(self, p, q):
if(p==None and q!=None):return False
elif (p!=None and q==None):return False
elif p==None and q==None:return True
return (self.isSameTree(p.left,q.left) and self.isSameTree(p.right,q.right))
Python 5 line solution
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.