Mbpp/763

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度759 字符
模型生成的代码 (759 字符)
def find_min_diff(arr, n):
    """
    Returns the minimum absolute difference between any two elements in the given array.
    
    Parameters:
    arr (tuple or list): The input array of numbers.
    n (int): The length of the array (can be ignored, but kept for interface compatibility).
    
    Returns:
    int/float: The minimum difference between any two elements.
    """
    # Sort the array to ensure that the minimum difference exists between adjacent elements
    sorted_arr = sorted(arr)
    min_diff = float('inf')
    
    # Compare each adjacent pair after sorting
    for i in range(1, len(sorted_arr)):
        diff = sorted_arr[i] - sorted_arr[i - 1]
        if diff < min_diff:
            min_diff = diff
            
    return min_diff
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试