def longest(self, cur):
        if not cur:
            return 0

        maxa = 1
        l = self.longest(cur.left)
        r = self.longest(cur.right)
        if cur.left and cur.val+1 == cur.left.val:
            maxa = max(maxa, l+1)
        if cur.right and cur.val+1 == cur.right.val:
            maxa = max(maxa, r+1)

        self.gmax = max(self.gmax, maxa)
        return maxa
longest ended at root
dataset/ETHPy150Open algorhythms/LeetCode/298 Binary Tree Longest Consecutive Sequence.py/Solution.longest