Open jesyspa opened 2 weeks ago
The algorithm checks only that the depth is non-negative. res := []; would be a valid implementation.
res := [];
Possible strengthenings:
parse_paren_group
parse_nested_parens
split
Note that this may require strengthening the precondition to ensure that the string really does consist of a number of groups.
The algorithm checks only that the depth is non-negative.
res := [];
would be a valid implementation.Possible strengthenings:
parse_paren_group
returns the maximum depth.parse_nested_parens
gives an array that matches with the behaviour ofsplit
andparse_paren_group
.Note that this may require strengthening the precondition to ensure that the string really does consist of a number of groups.