Mbpp/395

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度476 字符
模型生成的代码 (476 字符)
def first_non_repeating_character(s: str):
    """
    Returns the first non-repeating character in the given string.
    If no unique character exists, returns None.
    """
    # Count frequencies of each character
    char_count = {}
    for ch in s:
        char_count[ch] = char_count.get(ch, 0) + 1

    # Find the first character with count 1
    for ch in s:
        if char_count[ch] == 1:
            return ch

    # No non-repeating character found
    return None
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试