Problem solving with programming: Maximum nesting depth of a paranthesis expression
Given a parenthesis expression, We have to find the maximum nesting depth.
For example: the expression ()((()))(()) has a maximum nesting depth of 3.
The expression ((()())) has a maximum nesting depth of 3.
Let us output -1 for an unbalanced expressions such as (())) or ()(
This is a simple problem that can be asked in different forms. One such example can be
Given a sequence of jobs executed by a machine. What is the maximum number of parallel jobs executed at any point of time.One more variation of this problem can be
Given a maximum capacity of a computer center, and a sequence of people arrived, how many people have to wait for their turn.
Read full article from Problem solving with programming: Maximum nesting depth of a paranthesis expression
No comments:
Post a Comment