Mbpp/283

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度407 字符
模型生成的代码 (407 字符)
import collections
def validate(n: int) -> bool:
    """
    Returns True if for every digit in the integer, its frequency 
    is less than or equal to the digit itself.
    """
    # Consider absolute value to ignore possible minus sign
    s = str(abs(n))
    freq = collections.Counter(s)
    
    for digit, count in freq.items():
        if count > int(digit):
            return False
    return True
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试