a continuous tree is such that the absolute difference between two adjacent nodes is 1 can be continuous if 1 root is none 2 both left and right sts are none 3 if left st is none check for right 4 if right st is none check for left 5 else check for everything a continuous tree is such that the absolute difference between two adjacent nodes is 1 can be continuous if 1 root is none 2 both left and right sts are none 3 if left st is none check for right 4 if right st is none check for left 5 else check for everything
class Node:

    def __init__(self, val):
        self.val = val
        self.left = None
        self.right = None


def continuous(root):
    
    
    
    
    
    

    if root is None:
        return True
    
    if root.left == None and root.right == None:
        return True

    if root.left == None:
        return (abs(root.val - root.right.val) == 1) and continuous(root.right)

    if root.right == None:
        return (abs(root.val - root.left.val) == 1) and continuous(root.left)

    return (abs(root.val - root.right.val) == 1) and (abs(root.left.val - root.val) == 1) and continuous(root.left) and continuous(root.right)