Mbpp/283

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度422 字符
模型生成的代码 (422 字符)
def validate(n: int) -> bool:
    """
    Check whether the frequency of each digit in the integer is 
    less than or equal to the digit itself.
    """
    # Take absolute value to handle negative numbers (only digits matter)
    s = str(abs(n))
    freq = {}
    for ch in s:
        freq[ch] = freq.get(ch, 0) + 1
    for ch, count in freq.items():
        if count > int(ch):
            return False
    return True
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试