
    Write a function that validates a user's social connectivity score, where each digit in the score represents different interaction metrics, and ensures that the frequency of each metric type (digit) in the score doesn't exceed its own value to maintain balanced social connections. For example, if a user has a connectivity score of 1224, the digit 2 appears twice (which is valid since 2 >= 2), and digit 1 appears once (valid since 1 >= 1), making this a valid social connectivity pattern.
    

    
def validate(n):
    """
    Write a function that validates a user's social connectivity score, where each digit in the score represents different interaction metrics, and ensures that the frequency of each metric type (digit) in the score doesn't exceed its own value to maintain balanced social connections. For example, if a user has a connectivity score of 1224, the digit 2 appears twice (which is valid since 2 >= 2), and digit 1 appears once (valid since 1 >= 1), making this a valid social connectivity pattern.
    

    """
def validate(n):
    """
    Write a function that validates a user's social connectivity score, where each digit in the score represents different interaction metrics, and ensures that the frequency of each metric type (digit) in the score doesn't exceed its own value to maintain balanced social connections. For example, if a user has a connectivity score of 1224, the digit 2 appears twice (which is valid since 2 >= 2), and digit 1 appears once (valid since 1 >= 1), making this a valid social connectivity pattern.
    

    """
    for i in range(10):
        temp = n
        count = 0
        while temp:
            if temp % 10 == i:
                count += 1
            if count > i:
                return False
            temp //= 10
    return True