Mbpp/74

⚠️ 仅 Base 通过 Base: PASS Plus: FAIL
测试评估
指标结果
Base 测试PASS
Plus 测试FAIL
代码长度719 字符
模型生成的代码 (719 字符)
from typing import List, Any
def is_samepatterns(seq1: List[Any], seq2: List[Any]) -> bool:
    """
    Returns True if seq1 and seq2 follow the same pattern, i.e., the equality
    relationships among elements are identical. For example:
    ["red","green","green"] and ["a","b","b"] both have the pattern (0,1,1).
    """
    if len(seq1) != len(seq2):
        return False

    # Build normalised pattern: list of indices of first occurrence
    def pattern(seq: List[Any]) -> List[int]:
        seen = {}
        pat = []
        for item in seq:
            if item not in seen:
                seen[item] = len(seen)
            pat.append(seen[item])
        return pat

    return pattern(seq1) == pattern(seq2)
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • [['red', 'red', 'red', 'red', 'red', 'red'], ['a', 'b', 'c', 'a', 'b', 'c']]