<doocs>0968.Binary Tree Cameras_1.py
def dfs(root):
    nonlocal ans
    if root is None:
        return 2
    left, right = dfs(root.left), dfs(root.right)
    if left == 0 or right == 0:
        ans += 1
        return 1
    return 2 if left == 1 or right == 1 else 0
def sample_funcname ( var_1 ) :
    nonlocal var_2
    if var_1 is None :
        return 2
    left , right = var_0 ( var_1.left ) , var_0 ( var_1.right )
    if left == 0 or right == 0 :
        var_2 += 1
        return 1
    return 2 if left == 1 or right == 1 else 0
