测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 743 字符 |
模型生成的代码 (743 字符)
def check_min_heap(arr):
"""
Check if the given array represents a min heap.
A min heap is a binary tree where each parent node is less than or equal to its children.
In array representation (0-indexed):
- Left child of i is at 2*i + 1
- Right child of i is at 2*i + 2
"""
n = len(arr)
# For each parent node from last parent down to root
for i in range((n - 2) // 2, -1, -1):
left = 2 * i + 1
right = 2 * i + 2
# Check left child exists and property holds
if left < n and arr[i] > arr[left]:
return False
# Check right child exists and property holds
if right < n and arr[i] > arr[right]:
return False
return True
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试