
    Write a function that analyzes a transaction amount to detect potential fraud by checking if any digit appears more times than its actual value (e.g., digit 3 appearing 4 times would be suspicious). The function should return true if each digit's frequency is less than or equal to the digit itself, indicating a likely legitimate transaction, and false otherwise.
    

    
def validate(n):
    """
    Write a function that analyzes a transaction amount to detect potential fraud by checking if any digit appears more times than its actual value (e.g., digit 3 appearing 4 times would be suspicious). The function should return true if each digit's frequency is less than or equal to the digit itself, indicating a likely legitimate transaction, and false otherwise.
    

    """
def validate(n):
    """
    Write a function that analyzes a transaction amount to detect potential fraud by checking if any digit appears more times than its actual value (e.g., digit 3 appearing 4 times would be suspicious). The function should return true if each digit's frequency is less than or equal to the digit itself, indicating a likely legitimate transaction, and false otherwise.
    

    """
    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