测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 511 字符 |
模型生成的代码 (511 字符)
def sort_matrix(matrix):
"""
Sort the rows of a matrix in ascending order based on the sum of each row.
Args:
matrix (list of list of int): A 2D list representing the matrix.
Returns:
list of list of int: A new matrix with rows sorted by their sums.
"""
# Use the built-in sorted() with a key function that computes the sum of each row.
# sorted() is stable, so rows with equal sums keep their original relative order.
return sorted(matrix, key=sum)
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试