Given a string s representing a valid parentheses string expression, return the maximum nesting depth of parentheses in s.
The nesting depth at any position is the number of currently open parentheses that have not yet been closed. The answer is the largest such value over the entire string.
Note: It is guaranteed that
sis a valid parentheses string, meaning every opening parenthesis insis properly matched and closed in the correct order.
Constraints:
s.length
s consists of digits '+', '-', '*', '/', '(', and ')'
s is guaranteed to be a VPS
Given a string s representing a valid parentheses string expression, return the maximum nesting depth of parentheses in s.
The nesting depth at any position is the number of currently open parentheses that have not yet been closed. The answer is the largest such value over the entire string.
Note: It is guaranteed that
sis a valid parentheses string, meaning every opening parenthesis insis properly matched and closed in the correct order.
Constraints:
s.length
s consists of digits '+', '-', '*', '/', '(', and ')'
s is guaranteed to be a VPS