All MicroEvals
Complete the following Python function: ```python from typi...
Create MicroEval
Header image for Complete the following Python function:

```python
from typi...

Complete the following Python function: ```python from typi...

Prompt

Complete the following Python function: ```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] """ ```

Answer guidance

Canonical solution (function body): def parse_paren_group(s): depth = 0 max_depth = 0 for c in s: if c == '(': depth += 1 max_depth = max(depth, max_depth) else: depth -= 1 return max_depth return [parse_paren_group(x) for x in paren_string.split(' ') if x]

Drag to resize
Drag to resize
Drag to resize