测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 556 字符 |
模型生成的代码 (556 字符)
from collections import Counter
def max_occurrences(lst):
"""
Return the element with the highest frequency in the given list.
If there are multiple elements with the same maximum frequency,
the one appearing first in Counter's most_common() order is returned
(i.e., the smallest element due to how Counter handles ties).
Returns None for an empty list.
"""
if not lst:
return None
counter = Counter(lst)
# most_common(1) returns a list with one tuple (element, count)
return counter.most_common(1)[0][0]
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试