diameter of binary tree

🏠
 1class Solution:
 2
 3    def findHeight(self, root):
 4        if root is None:
 5            return 0
 6        
 7        lH = self.findHeight(root.left)
 8        rH = self.findHeight(root.right)
 9        
10        self.maxPathLen = max(self.maxPathLen, lH + rH)
11        return max(lH, rH) + 1
12
13
14    def findDiameter(self, root):
15        self.maxPathLen = 0    
16        self.findHeight(root)
17        return self.maxPathLen