测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 689 字符 |
模型生成的代码 (689 字符)
def remove_dirty_chars(string1: str, string2: str) -> str:
"""
Remove characters from string1 that are present in string2.
Args:
string1: The input string from which characters are removed.
string2: The string containing characters to be removed.
Returns:
A new string with all characters from string1 that are not in string2.
"""
# Using a set for string2 lookup is more efficient if string2 is long.
# For small strings, the linear check 'not in string2' is fine.
# But for correctness and potential large inputs, we can use:
remove_set = set(string2)
return ''.join(c for c in string1 if c not in remove_set)
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试