<doocs>0298.Binary Tree Longest Consecutive Sequence_1.py
def dfs(root, p, t):
    nonlocal ans
    if root is None:
        return
    t = t + 1 if p is not None and p.val + 1 == root.val else 1
    ans = max(ans, t)
    dfs(root.left, root, t)
    dfs(root.right, root, t)
def sample_funcname ( var_1 , var_2 , var_3 ) :
    nonlocal var_4
    if var_1 is None :
        return
    var_3 = var_3 + 1 if var_2 is not None and var_2.val + 1 == var_1.val else 1
    var_4 = max ( var_4 , var_3 )
    var_0 ( var_1.left , var_1 , var_3 )
    var_0 ( var_1.right , var_1 , var_3 )
