测试评估
| 指标 | 结果 |
|---|---|
| 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 失败测试用例
- 无失败测试