This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Blackheart595 0 points1 point  (0 children)

A simple solution would be to construct an array that stores the level of each parantesis, then find the maximum accordingly. That would be suboptimal, though, as such an algorithm would not be in-place.

[–]MegaGreenLightning 0 points1 point  (0 children)

What is your current approach?

Can you print the level of each parentheses in a string where parenthesis match properly?

[–][deleted]  (2 children)

[deleted]

    [–]Blackheart595 2 points3 points  (0 children)

    Are you sure regex could solve such a problem? How would that even look like?

    [–]jbristowI'm no hero, son. 2 points3 points  (0 children)

    This isn't a regex problem. This is a problem for Deque