he-006
0.000
Challenge · difficulty 3/5
# HumanEval/6
Implement a file **`solution.py`** that completes the function below. Keep the given name and signature; your file must define it at module level.
```python
from typing import List
def parse_nested_parens(paren_string: str) -> List[int]:
""" Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
For each of the group, output the deepest level of nesting of parentheses.
E.g. (()()) has maximum two levels of nesting while ((())) has three.
>>> parse_nested_parens('(()()) ((())) () ((())()())')
[2, 3, 1, 3]
"""
```
<!-- imported from OpenAI HumanEval (HumanEval/6) -->
tests/test_he_006.py
# Auto-generated from OpenAI HumanEval HumanEval/6. Do not edit by hand.
from solution import * # noqa: F401,F403 (prompt helpers may be referenced by tests)
from solution import parse_nested_parens as candidate
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3]
assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4]
assert candidate('(()(())((())))') == [4]
def test_he_006():
check(candidate)
Proposed solution
Solution.py
1
347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347 347Errors (stderr)
no code extracted from response